Post Reply 
HP49-50G Lambert function
10-19-2020, 09:06 AM
Post: #3
RE: HP49-50G Lambert function W(z)
Lamber function for HP49-50G
W.Z=>X

Version 2.
- That version allows now complex numbers Z as argument (and will give a complex number as answer.

- Having the Z complex number,
find the complex solution small z,
such that (...z) × EXP (...z) = Z.

- The program allows also, as argument, negative numbers < -1/e, in which case the answer will also be a complex number z.

- For the other cases, when entering
Y W(Z) ENTER,
we get the searched real value x=W(Y).

- The program gives almost instantaneous answer,
but do no tamper on previously registered variable.

- Here is the new program code:
« "Lambert W(Z):
Having result Y
Y real in (-879.3 infinity)
or Z complex (a,b)
W(Z) finds / gives X
such that
(X * EXP X) = Z
W(X * EXP X) =X

" DROP =>Y
«
IF Y TYPE 1. == NOT
THEN
IF Y -1. EXP NEG <
THEN Y 0. RC 'Y' STO
END
END
IFERR 'X' 'X' RCL
THEN
ELSE
END
IF Y TYPE 1. ==
THEN DUP2 SAME NOT
IF
THEN 'X' PURGE
END 'a*EXP(a)*COS(b)-b*EXP(a)*SIN(b)' Y OBJ DROP = 'a*EXP(a)*SIN(b)+b*EXP(a)*COS(b)' Y CR SWAP DROP = 2. ARRY 'a' 'b' 2. ARRY [ 1. 1. ] MSLV OBJ DROP RC UNROT DROP2
ELSE 'X*EXP(X)-Y' 'X' 1. ROOT
END UNROT DUP2 SAME
IF
THEN DROP2 'X' PURGE
ELSE SWAP STO
END "W(" Y + ")" + =>TAG
»
»
Example of use:

What is the Lambert x value for y=(sqrt 2) /2?
1) 2 SQRT 2 / gives. 707
2) 2 SQRT 2 / W.Y=>X gives 0.4506

Application:

Solve x^2*e^x=2

Take square root of the above expression:
x*e^(x/2) = sqrt 2

Divide by 2:
(x/2)*e^(x/2) = (sqrt 2) / 2

That has a form of:
"(X..X)" * e ^"(X..X) " = (sqrt 2)/2

Then W ["(X..X)" * e ^"(X..X)"] = W [(sqrt 2)/2]
Or "X.. X" = W [(sqrt 2)/2]

In our case we have:
W[(x/2)*e^(x/2)] = W[(sqrt 2) / 2]
Or x/2 = W[(sqrt 2) / 2]
Or x = 2 * W[(sqrt 2) / 2] = 2 * 0.4506 = 0.9012

Remarks welcome.

Regards,
Gil Campart


Attached File(s)
.doc  W.Z_X.version2.DOC (Size: 726 bytes / Downloads: 2)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP49-50G Lambert function - Gil - 10-17-2020, 08:42 PM
RE: HP49-50G Lambert function - Gil - 10-18-2020, 10:22 AM
RE: HP49-50G Lambert function W(z) - Gil - 10-19-2020 09:06 AM
RE: HP49-50G Lambert function - Gil - 10-19-2020, 09:13 AM
RE: HP49-50G Lambert function - Gil - 10-19-2020, 09:40 AM
RE: HP49-50G Lambert function - Gil - 10-20-2020, 08:28 AM
RE: HP49-50G Lambert function - Gil - 10-20-2020, 08:42 AM
RE: HP49-50G Lambert function - Gil - 10-20-2020, 10:44 PM
RE: HP49-50G Lambert function - Gil - 10-21-2020, 11:44 AM



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