Calculating e^x-1 on classic HPs
|
01-14-2016, 02:47 AM
(This post was last modified: 01-14-2016 03:14 PM by Gerson W. Barbosa.)
Post: #12
|
|||
|
|||
RE: Calculating e^x-1 on classic HPs
(01-13-2016 06:43 PM)Dieter Wrote: On the other hand a dedicated ex–1 function is only required for ln 0,9 < x < ln 2, and here your method works fine. One might add two additional tests to check whether the argument is within these bounds or not. Which again makes the method less elegant... Still not elegant, but I decided to try a series approach. Starting with an empirical approximation (I noticed e^x - 1 ~ e^(ln(x) + x/2) for small x), I came up with a new Taylor series -- Well, at least apparently W|A missed it... \[e^{x}-1=e^{\ln(x)+p(x)}\] \[\ln(e^{x}-1)=\ln(x)+p(x)\] \[p(x)=\ln(e^{x}-1)-\ln(x)\] \[p(x)=\ln\left (\frac{e^{x}-1}{x}\right)\] \[\cdots\] \[p(x)=\frac{x}{2}+\frac{x^{2}}{24}-\frac{x^{4}}{2880}+\frac{x^{6}}{181440}-\frac{x^{8}}{9676800}+\frac{x^{10}}{479001600}-\frac {691\cdot x^{12}}{15692092416000}+\cdots\] \[p(x)=\frac{x}{2}+\sum_{k=1}^{\infty} \frac{B_{2k}\cdot x^{2k}}{2k\cdot (2k)!}\] \[\therefore e^{x}-1=e^{\ln(x)+\frac{x}{2}+\sum_{k=1}^{\infty} \frac{B_{2k}\cdot x^{2k}}{2k\cdot (2k)!} }\] Only four terms of the summand would suffice for 10-digit calculators in the specified range (five terms for 12-digit calculators). This would take too many steps on the Voyagers, however. Anyway, the first two or three terms might be useful for certain applications if x is always positive and small enough. Just for the sake of illustration and testing, here is an HP-49G/G+/50g version: Code:
2 LN EXM1 -> 1. 1.23E-8 EXM1 -> 1.23000000759E-8 -0.1 EXM1 RE -> -9.51625819644E-2 -0.1 EXPM -> -.095162581964 ; built-in EXPM function 1.23E-8 EXPM -> 1.23000000756E-8 Best regards, Gerson. Edited per Dieter's observation below (1.23E-8 EXPM -> 1.23000000756E-8, not 1.2300000076E-8) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 9 Guest(s)