Calculating e^x1 on classic HPs

01122016, 02:02 PM
(This post was last modified: 01122016 03:06 PM by Dieter.)
Post: #4




RE: Calculating e^x1 on classic HPs
(01122016 05:13 AM)Claudio L. Wrote: I just checked at 2000 digits precision and the result was good. Fine. My results on 10 and 12digit calculators did not show any results with larger errors than ±1 ULP, mostly because of different rounding. The vast majoriy was dead on. (01122016 05:13 AM)Claudio L. Wrote: I always thought e^x1 was the easiest of all to implement, since the power series expansion at 0 starts with a 1. All you have to do is skip the first term and with relatively few terms in the summation you get the answer. No need to worry about argument reduction because the whole point is to use it around zero. Right. This is true if you want to evaluate e^{x}–1 in terms of simple arithmetics, i.e. without the use of other transcendental functions. Which may be a good idea on a computer, but not on a calculator where speed and memory are much more limited. (01122016 05:13 AM)Claudio L. Wrote: Question is: would a program computing terms of the power series in a loop be faster? I'd say this depends on the implementation of the required exponential and logarithm functions. On most common processors this is done in hardware (the FPU provides these functions). On the required interval (ln 0,9 < x < ln 2) and 1516 digit accuracy a continued fraction method with 7 terms or a 16term series expansion will do. Now, how much faster are addition, multiplication and division compared to exp and log? The continued fraction method requires 14 divisions, 7 additions and 7 subtractions, plus a bit overhead for the range check and the loop counter. I suppose this is still faster than using exp and log. On a computer, that is. For the record, here is a VBA implementation using the continued fraction method and hardcoded seven terms (k = 13, 11, 9, 7, 5, 3, 1): Code: Function expm1cf(x) Dieter 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)