Post Reply 
Calculating e^x-1 on classic HPs
01-11-2016, 10:20 PM (This post was last modified: 01-11-2016 10:22 PM by Dieter.)
Post: #1
Calculating e^x-1 on classic HPs
There is no doubt that the ln(1+x) and ex–1 functions that appeared with the 41C are extremely useful as they allow more precise calculations for arguments close to zero, which otherwise would round to zero. The 15C Advanced Functions Handbook included a short routine for emulating ln(1+x) on calculators that no not feature this function, and another (IMHO slightly better) method has been posted in this forum.

On the other hand, the ex–1 case seemed more challenging. Thomas Klemm posted a solution that included the hyperbolic sine for a short and elegant implementation of this function. However, not all HPs offer hyperbolic functions.

Here is a method that should work on most classic HPs. I think it works fine but I did not do any extensive tests. So try it and see what you get. Coded in VBA, the algorithm is as follows:

Code:
Function expm1(x)
   u = Exp(x)
   expm1 = (u - 1) + (x - Log(u)) * u
End Function

On a classic HP it could look like this:

Code:
ENTER
e^x
ENTER
ENTER
LN
CHS
R^
+
x
x<>y
1
-
+
RTN

This returns ex in Y and ex–1 in X.
What do you think?

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Calculating e^x-1 on classic HPs - Dieter - 01-11-2016 10:20 PM



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