Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm working on a multiple-precision library. I'd like to make it possible for users to ask for higher precision answers for results already computed at a fixed precision. My $\mathrm{sqrt}(x)$ can pick up where it left off, even if $x$ changes a bit, because it uses Newton-Raphson. But $\exp(x)$ computed using a Maclaurin series or continued fraction has to be computed from scratch.

Is there an iterative refinement (i.e. Newton-Raphson, gradient descent) method for computing $\exp(x)$ that uses only arithmetic and integer roots?

(I know Newton-Raphson can solve $\log(y)-x=0$ to compute $\exp(x)$. I am specifically not asking for that. Newton-Raphson can also solve $\exp(y)-x=0$ to compute $\log(x)$. Note that each requires the other. I have neither right now as an arbitrary-precision function. I have arithmetic, integer roots, and equality/inequality tests.)

share|improve this question
1  
I don't believe there's a refinement scheme for $\exp(z)$. The best I've seen, assuming you're using scaling+squaring, is to have to redo series/CF computations on a version of $z\cdot2^{-n}$ with greater precision, and then square $n$ times. –  J. M. Sep 25 '10 at 6:01
1  
Not sure if it helps, I know there is an algorithm to compute kth digit of pi (in base 16). Perhaps something like that exists for exp(x) in base 10/whatever base you are working in. Spigot algorithm is the name I believe. (not sure) –  Aryabhata Sep 25 '10 at 13:41
    
There is a spigot algorithm for $e$, but I don't see how it generalizes to $\exp(x)$. –  J. M. Sep 25 '10 at 23:32
1  
@J.M., it generalises to convergent hypergeometrics. See math.stackexchange.com/questions/18445/… for code –  Peter Taylor Jan 21 '11 at 18:18
add comment

1 Answer

There is an algorithm for computing $\log_2(x)$ that might suit you. Combine that with the spigot algorithm for $e$, and you can get $\ln(x)$. From there, you can use Newton-Raphson to get $\exp(x)$.

I don't know if this roundabout way ends up doing any better than just recomputing.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.