Post Reply 
(28/48/50) Lambert W Function
03-23-2023, 05:53 PM
Post: #10
RE: (28/48/50) Lambert W Function
(03-23-2023 12:16 AM)Albert Chan Wrote:  There is a flaw with Iacono and Boyd W guess formula.
If x is tiny enough, below 6e-10, it could return a negative guess.
This cause Newton formula to take a log of negative number, which crash it.

That explains the problem that I saw when |z| was < 10^8. Lines 3 and 7 of my first program are a patch around the flaw. The program doesn't crash without the patch but it returns a complex result in a different branch.

There is one line in your program that concerns me:

if h == err then return -1 end

It seems that the program would return -1 if a is the closest machine representation of -1/e, which would be -.367879441171 on the HP calculators. Instead, we would want the program to return -.999998449288 in branch 0, or -1.00000155071 in branch -1, which are the correct 12-digit representations of W(-.367879441171).

My apologies if I am reading your program incorrectly.

Also, there is another line whose meaning is unclear to me:

x = sqrt(2*h/r) * (x and -1 or 1)

In RPL this statement always returns 1.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(28/48/50) Lambert W Function - John Keith - 03-20-2023, 08:43 PM
RE: (28/48/50) Lambert W Function - John Keith - 03-23-2023 05:53 PM
RE: (28/48/50) Lambert W Function - Gil - 01-29-2024, 11:04 AM
RE: (28/48/50) Lambert W Function - Gil - 01-29-2024, 02:47 PM
RE: (28/48/50) Lambert W Function - Gil - 01-29-2024, 06:46 PM
RE: (28/48/50) Lambert W Function - Gil - 01-29-2024, 09:50 PM
RE: (28/48/50) Lambert W Function - Gil - 01-30-2024, 12:33 AM
RE: (28/48/50) Lambert W Function - Gil - 01-30-2024, 12:04 PM
RE: (28/48/50) Lambert W Function - Gil - 01-30-2024, 02:52 PM
RE: (28/48/50) Lambert W Function - Gil - 01-31-2024, 07:10 PM



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