(HP35S) Lambert W Function - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (HP35S) Lambert W Function (/thread-22199.html) |
(HP35S) Lambert W Function - Roberto Volpi - 08-19-2024 10:49 AM 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. RE: (HP35S) Lambert W Function - PedroLeiva - 08-19-2024 12:14 PM 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 RE: (HP35S) Lambert W Function - jdebord - 08-20-2024 06:23 AM There are lots of applications for this function: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8276860/pdf/nihms-1683491.pdf Personally I have used it for enzyme kinetics and sorption kinetics/thermodynamics. RE: (HP35S) Lambert W Function - Roberto Volpi - 08-20-2024 09:49 AM 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. RE: (HP35S) Lambert W Function - PedroLeiva - 08-20-2024 11:00 AM Thank you Roberto!! |