Post Reply 
Lambert W Function (hp-42s)
05-16-2020, 04:07 PM
Post: #1
Lambert W Function (hp-42s)
The Lambert W Function can be implemented in your calculator using Newton's Method. To find W(A), the equation to solve is:
f(x) = x*exp(x)-A = 0 (1)
f”(x) = (x+1)*exp(x) (2)

A recursive formula for Newton's Method is:
X = x+(A/exp(x)-x)/(x+1)) (3)

From (1) we have x*exp(x) = A or ln(x) + x = ln(A); x = ln(A)-ln(x); x ~ ln(A); ln(A) is a good initial value for the Newton Method when A>1, ln(A+1.4) is a good initial value for all reals ≥ -1/e, for complex numbers we use ln(A).

The next program implements the Lambert W Function For the hp 42s:

01 LBL “LWF”
02 1.4
03 X<>Y
04 ENTER
05 REAL?
06 RCL+ ST Z
07 LN
08 STO “X”
09 LBL 00
10 X<>Y
11 RCL ST X
12 RCL “X”
13 E↑X
14 ÷
15 RCL- “X”
16 1
17 RCL+ “X”
18 ÷
19 STO+ “X”
20 ABS
21 1E-32
22 -
23 X>0?
24 GTO 00
25 RCL “X”
26 END

The program doesn't check if you entered a value where the function its not defined. Values of x < -1/e should be entered as complex.
The strategy to solve equations with exponential using the Lambert W Function is to use algebraic manipulations to get an equation of the form x*exp(x) = a; then x = W(a)
or x*ln(x) = a; then ln(x) = W(a) and x = exp(W(a)).

Example: to solve x^x = π, we have ln(x^x) = ln(π), x*ln(x) = ln(π); x = exp(W(ln(π))); in the calculator:

[■][π][LN][XEQ][LWF][■][e^x] give us a value of x ~ 1.85410596792.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Lambert W Function (hp-42s) - Juan14 - 05-16-2020 04:07 PM
RE: Lambert W Function (hp-42s) - Werner - 05-17-2020, 07:56 AM
RE: Lambert W Function (hp-42s) - Werner - 05-17-2020, 08:15 AM
RE: Lambert W Function (hp-42s) - Gerald H - 05-17-2020, 09:29 AM
RE: Lambert W Function (hp-42s) - Werner - 05-18-2020, 08:04 AM
RE: Lambert W Function (hp-42s) - Juan14 - 05-17-2020, 12:12 PM
RE: Lambert W Function (hp-42s) - Juan14 - 05-18-2020, 10:51 PM
RE: Lambert W Function (hp-42s) - Juan14 - 05-21-2020, 12:09 AM
RE: Lambert W Function (hp-42s) - Werner - 05-22-2020, 11:39 AM
RE: Lambert W Function (hp-42s) - Werner - 05-23-2020, 04:20 AM
RE: Lambert W Function (hp-42s) - Werner - 06-11-2020, 05:17 AM
RE: Lambert W Function (hp-42s) - Werner - 06-11-2020, 09:20 AM
RE: Lambert W Function (hp-42s) - lyuka - 09-28-2020, 04:06 PM
RE: Lambert W Function (hp-42s) - Werner - 09-30-2020, 09:12 AM
RE: Lambert W Function (hp-42s) - Werner - 10-02-2020, 03:02 PM
RE: Lambert W Function (hp-42s) - Werner - 09-30-2020, 07:08 AM
RE: Lambert W Function (hp-42s) - lyuka - 09-29-2020, 09:21 AM
RE: Lambert W Function (hp-42s) - lyuka - 09-29-2020, 11:17 PM
RE: Lambert W Function (hp-42s) - lyuka - 09-30-2020, 11:04 AM
RE: Lambert W Function (hp-42s) - lyuka - 09-30-2020, 07:16 PM
RE: Lambert W Function (hp-42s) - Werner - 10-01-2020, 09:37 AM
RE: Lambert W Function (hp-42s) - Werner - 10-01-2020, 01:39 PM
RE: Lambert W Function (hp-42s) - lyuka - 10-01-2020, 06:25 PM
RE: Lambert W Function (hp-42s) - lyuka - 10-02-2020, 05:44 AM
RE: Lambert W Function (hp-42s) - lyuka - 10-03-2020, 07:56 PM
RE: Lambert W Function (hp-42s) - Werner - 10-05-2020, 08:03 AM
RE: Lambert W Function (hp-42s) - lyuka - 10-05-2020, 06:09 PM
RE: Lambert W Function (hp-42s) - Werner - 10-06-2020, 06:16 AM
RE: Lambert W Function (hp-42s) - lyuka - 11-09-2020, 08:30 AM



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