feq/ansatz.lua

32 lines
829 B
Lua

--Solve the functional equation f' o f = id by ansatz:
--assume f(x) = ax ^ b. Then
--f' o f (x) = ba^b * x ^ ( b ( b-1 ) )
local phi = 0.5 + math.sqrt( 5 ) / 2
local ihp = 0.5 - math.sqrt( 5 ) / 2
local a, b = math.pow( phi, ihp ), phi
local function SeriesCoefficients( )
local a, b = math.pow( phi, ihp ), phi
local coefs = {[0] = phi}
local c, d = a, b
for i = 1, 150 do
c = c * d
d = d - 1
coefs[i] = c * math.pow( phi, d )
end
return coefs
end
--SeriesCoefficients()
local c, d = math.pow( ihp, phi ), ihp
return {
pos = function( x ) return a * math.pow( x, b ) end,
dpo = function( x ) return a * b * math.pow( x, b - 1 ) end,
neg = function( x ) return c * math.pow( x, d ) end,
dne = function( x ) return c * d * math.pow( x, d - 1 ) end,
coefs = SeriesCoefficients()
}