4 ms·
e^x = sum_n x^n/n! = 1 + x + (x^2)/2 + (x/3)/6... = 1 + x(1 + (x/2)(1 + (x/3)(1 +... exp(x,n) = 1 + (x/n)*exp(x,n+1) this gives you the exponential function
by IIAOPSW 2y ago
e^x = sum_n x^n/n!
= 1 + x + (x^2)/2 + (x/3)/6...
= 1 + x(1 + (x/2)(1 + (x/3)(1 +...
exp(x,n) = 1 + (x/n)*exp(x,n+1)
this gives you the exponential function as a recursion formula. Just set some condition for when to truncate. From there, a recursive function that does the exact opposite is easy enough.
I'm sure there are optimizations you can do on top in the case that you don't get convergence within the first few terms.
- agumonkey 2y agoThanks that's the kind of process I was aiming at but was stuck early.