[math-fun] less lumpy fun function
So, my superexponential function turned out like the Minkowski question mark function, i.e. fractally lumpy. I wanted a flattish area around zero (super negative exponentials) but no other lumps. Including (successive approximations to) the inverse function in the feedback loop started to reduce the lumps very slowly for a lot of work. Bah. But in the process I got the idea of an "index function" i(x), where something like f(x) = exp_like_function( f( i( x ) ) ). So here is the current hack, in Python: def f( x ): if abs( x ) < 2**-27: return x * 1.1390199403775014 else: return 3.0 * sinh( f( ( 2.0 * x**3 + x ) / 3.0 ) ) i(x) = ( 2 x^3 + x ) / 2 -- i(+/- 1) = +/- 1 and i'(+/- 1) = 2. The 3.0 before the sinh is necessary so that f'(0) = f'(0). The 2**-27 is approximately where asinh() and i() stop being linear to double precision. The 1.1390199403775014 is f'(0) such that f(.5) = 1. To get the inverse function I need to solve the cubic in i(x). f(x) looks like an tangent function except it does a superexponential thing on the way up and down. It's not flat near zero, to get that you can do def g( x ): if x < 0: return -g( -x ) elif x == 0: return 0 else: return exp( f( 2.0 * x - 1.0 ) ) Except for catching infinities near g(0). There is a wobble between g(0) and g(1), which can be fixed to make a prettier plot, but I'm not sure it's a better function for it. Plot: http://www.tiac.net/~sw/2010/03/Superbola/superbolav.pdf Code: http://www.tiac.net/~sw/2010/03/Superbola/superbolav.py --Steve
participants (1)
-
Steve Witham