HP Forums
Lambert function W0 for very big argument - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Lambert function W0 for very big argument (/thread-17941.html)



Lambert function W0 for very big argument - Pekis - 01-17-2022 02:32 PM

Hello,

In exponential equations, it's not unusual to have to calculate W0(x) with a very big x, overflowing most of the calculators.

For example: Solve 2^x = 1000 - x
Solution is x = 1000 - W0(2^1000 * ln(2)) / ln(2) = approx. 9.9514, but for a calculator overflowing at 10^100, that's a problem.

So, here's the trick:
Usually, to calculate W(p) with p>0, you solve x * e^x - p = 0 for example with Newton's method, needing p as input:
Initial x = ln(p) - ln(ln(p)) for a W0 result (if p > 10)
iterate on x = (x * x + p * e^(-x)) / (x + 1) converging to x = W0(p)

But if p is very big, you can solve instead ln(x) +x - ln(p) = 0, needing ln(p) as input:
Initial x = ln(p) - ln(ln(p)) for a W0 result
iterate on x = x * (1 - ln(x) + ln(p)) / (x + 1) converging to x = W0(p)
So, if you enter ln(p) in a way the calculator allows it, you'll get directly W0(p).
In the above example, you won't input 2^1000 * ln(2) but 1000 * ln(2) + ln(ln(2))

I made some little programs for calculating W0 et W-1 for the Casio fx-5800P and you can see them here: Eddie's Math and Calculator Blog

Thanks for reading