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
 Gerson W. Barbosa Senior Member Posts: 1,244 Joined: Dec 2013
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:
 « 0 → x s   « 1 5      FOR i i DUP + DUP x SWAP ^ OVER IBERNOULLI * OVER ! / SWAP / 's' STO+      NEXT      s x 2 / + x LN + EXP   » »

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 »

 Messages In This Thread Calculating e^x-1 on classic HPs - Dieter - 01-11-2016, 10:20 PM RE: Calculating e^x-1 on classic HPs - Thomas Klemm - 01-12-2016, 01:41 AM RE: Calculating e^x-1 on classic HPs - Dieter - 01-12-2016, 06:12 PM RE: Calculating e^x-1 on classic HPs - Claudio L. - 01-12-2016, 05:13 AM RE: Calculating e^x-1 on classic HPs - Dieter - 01-12-2016, 02:02 PM RE: Calculating e^x-1 on classic HPs - ElectroDuende - 01-12-2016, 03:34 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-12-2016, 06:30 PM RE: Calculating e^x-1 on classic HPs - Claudio L. - 01-12-2016, 09:44 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-12-2016, 08:16 PM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-13-2016, 03:46 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-13-2016, 06:43 PM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-14-2016 02:47 AM RE: Calculating e^x-1 on classic HPs - Dieter - 01-14-2016, 01:44 PM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-14-2016, 03:30 PM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-14-2016, 06:50 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-14-2016, 07:38 PM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-14-2016, 07:50 PM RE: Calculating e^x-1 on classic HPs - Albert Chan - 02-02-2019, 07:32 PM RE: Calculating e^x-1 on classic HPs - Dieter - 02-03-2019, 06:46 PM RE: Calculating e^x-1 on classic HPs - Paul Dale - 01-14-2016, 07:20 AM RE: Calculating e^x-1 on classic HPs - Dieter - 01-14-2016, 01:48 PM RE: Calculating e^x-1 on classic HPs - emece67 - 01-14-2016, 03:55 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-14-2016, 06:42 PM RE: Calculating e^x-1 on classic HPs - emece67 - 01-14-2016, 09:14 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-14-2016, 09:55 PM RE: Calculating e^x-1 on classic HPs - Paul Dale - 01-15-2016, 01:19 AM RE: Calculating e^x-1 on classic HPs - Dieter - 01-15-2016, 02:00 PM RE: Calculating e^x-1 on classic HPs - matthiaspaul - 01-15-2016, 10:10 AM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-15-2016, 06:07 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-15-2016, 06:46 PM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-15-2016, 10:45 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-16-2016, 08:19 AM RE: Calculating e^x-1 on classic HPs - Gerson W. Barbosa - 01-16-2016, 12:40 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-16-2016, 01:32 PM RE: Calculating e^x-1 on classic HPs - Albert Chan - 02-02-2019, 07:22 PM RE: Calculating e^x-1 on classic HPs - Paul Dale - 01-14-2016, 09:22 PM RE: Calculating e^x-1 on classic HPs - Dieter - 01-14-2016, 09:49 PM RE: Calculating e^x-1 on classic HPs - Paul Dale - 01-15-2016, 01:15 AM RE: Calculating e^x-1 on classic HPs - Albert Chan - 02-03-2019, 08:28 PM RE: Calculating e^x-1 on classic HPs - Albert Chan - 02-04-2019, 07:28 PM RE: Calculating e^x-1 on classic HPs - Dieter - 02-04-2019, 07:59 PM

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