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. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)