Post Reply 
(HP35S) Lambert W Function
08-19-2024, 10:49 AM (This post was last modified: 08-20-2024 11:17 AM by Roberto Volpi.)
Post: #1
(HP35S) Lambert W Function
Hi all

The following program, using the native solver, can compute numerical values of the Lambert W Function, and also those resulting by substituting e with an arbitrary positive constant “a”.



The Lambert W Function can be defined as the inverse of y=xe^x.

As the implicit form x=ye^y is not very useful onto itself, we can use the native solver of our beloved HP35S to obtain a numerical solution, just by using a short program and an even shorter subroutine.

The program is:

LBL L
STO X
FN=W
SOLVE W
RCL X
x<>y
RTN

The subroutine is:

LBL W
RCL W
e^x
RCL xW
RCL -X
RTN

INSTRUCTIONS:

- Input value, whose L(W) we wish to calculate (it will be stored STO X)
- XEQ L

Our HP35S will display:

- X value on stack y
- Its L(W) on stack x


A FUNCTION WITH (STILL?) NO NAME.

Instead of e, we can use an arbitrary positive constant, which we shall name “a”, and we obtain a more general form of the Lambert W Function, which sometimes can be useful to solve quickly some equations, without manipulating them to obtain a xe^x form.

Just let a^x = e^(x ln a) and that’s it.

Now the W subroutine will be as follows:

LBL W
RCL A
RCL W
y^x
RCL xW
RCL -X
RTN

INSTRUCTIONS:

- Input “a” value, and press STO A
- Input value, whose L(W) we wish to calculate (it will be stored STO X)
- XEQ L

Our HP35S will display:

- X value on stack y
- Numerical result of that unnamed funtion on stack x

I have found no written reference of that new function. My wife, with her spiffing sense of humour, told me that I can baptize it with my name…

I see that very few programs for the HP35S have been submitted in recent times, and that is unfortunate, because this calculator can be still a valuable tool for both professionals and students.



Put a calculator into your life!
Visit this user's website Find all posts by this user
Quote this message in a reply
08-19-2024, 12:14 PM
Post: #2
RE: (HP35S) Lambert W Function
Dear Roberto, I completely agree about your comment that there are few programs of HP35s in MoHPC; thanks for your contributions.
I would like to have a practical application example of the use of Lambert Function, also if possible, a numerical example.
Thank you in advance, Pedro
Find all posts by this user
Quote this message in a reply
08-20-2024, 06:23 AM
Post: #3
RE: (HP35S) Lambert W Function
There are lots of applications for this function:

https://www.ncbi.nlm.nih.gov/pmc/article...683491.pdf

Personally I have used it for enzyme kinetics and sorption kinetics/thermodynamics.
Find all posts by this user
Quote this message in a reply
08-20-2024, 09:49 AM (This post was last modified: 08-20-2024 11:16 AM by Roberto Volpi.)
Post: #4
RE: (HP35S) Lambert W Function
Here some little example:

Find L(w) of e, even if, by inspection, we already know it is 1.
Use the subroutine W with e^x in the 2nd line

- press 1; e^x to obtain the numerical value of e
- press XEQ L
- stack y will display e and stack x will display 1

Find L(w) of 3

- press 3 and XEQ L
- stack y will display 3, and stack x will display 1.04990889496

It is the same result we can obtain with Wolfram Alpha, but with more significant decimal digits.

Find L(w) of 4

- Our HP35S will give 1.2021678732
- Wolfram Alpha will give 1.202167873219...
- the approximation given by our calculator is satisfactory.

Examples with the "general form" (or whatever the name) maybe tomorrow.



Put a calculator into your life!
Visit this user's website Find all posts by this user
Quote this message in a reply
08-20-2024, 11:00 AM
Post: #5
RE: (HP35S) Lambert W Function
Thank you Roberto!!
Find all posts by this user
Quote this message in a reply
Post Reply 




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