Re: exponentials

new topic     » topic index » view thread      » older message » newer message

Someone (I think it was Jeff) wrote in with a very cunning way of calculating
and exponential using log. Here is a more efficient way of doing it

To calculate e(x) use the following iteration
1 + nx + (nx^2)/2! + (nx^3)/3! + (nx^4)/4! ... + (nx^(r-1))/(r-1)!

This can be simplified into the following code :

constant E=2+1/2+1/6+1/24+1/120+1/720+1/5040+1/40320 ...

or

constant E=2.718281828459 --Derive some more if this is not enough. There is a
floating
                                           --point library in the user
contributions somewhere

then

global function exp(object x) --power() works on sequences too !
    return power(E,x)
end function

"Can you live a moment longer by worrying about it ?"

Daniel

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu