Calculating e^x-1 on classic HPs
|
01-12-2016, 06:12 PM
(This post was last modified: 01-15-2016 02:12 PM by Dieter.)
Post: #6
|
|||
|
|||
RE: Calculating e^x-1 on classic HPs
(01-12-2016 01:41 AM)Thomas Klemm Wrote: Brilliant! Thank you very much. Indeed the idea behind this is rather trivial. I'd like to explain this method with an example. Assume x = 3,141592654 E-6 and a 10-digit calculator. Evaluating u = ex with 10 digit precision yields u = 1,000003142 Accordingly, ex–1 is evaluated as u-1 = 0,000003142 But that's not ex or ex-1. The correct values are ex = 1,0000031415975888... ex–1 = 0,0000031415975888... The 10-digit result we got actually is not ex but eln u = e3,141995064E-6 (resp. this minus one). Simply because only eln u exactly equals u: eln u = u = 1,000003142000000... eln u – 1 = 0,000003142000000... So we got an exact result for an argument that is slightly off. Precisely, we want the result for an argument that it is off by dx = x – ln u Now the rest is easy. With the first terms of a Taylor series we get f(x+dx) ≈ f(x) + dx · f'(x) and thus: ex-1 ≈ e^(ln u) - 1 + (x - ln u) · d[ex–1]/dx = (u - 1) + (x - ln u) · ex ...and since u agrees with ex to machine accuracy we finally get: ex-1 ≈ (u - 1) + (x - ln u) · u That's it. Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)