Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decimal.lambertw occasionally spikes with inputs around the ee31 range #163

Open
James103 opened this issue Mar 23, 2024 · 0 comments
Open

Comments

@James103
Copy link

James103 commented Mar 23, 2024

When running the following:

[
Decimal.lambertw("ee31.666733435898778").toString(),
Decimal.lambertw("ee31.666733435898788").toString(),
Decimal.lambertw("ee31.666733435898798").toString()
]

the output is

[
"1.0689296521861698e32",
"2.575091926685474e3133",
"1.0689296521862222e32"
]

The second value is many orders of magnitude higher that of the first and third values, effectively a large spike.
The correct answer for the second expression is approximately midway between the first value and the third value.

Some more test cases, all of which return incorrect values
W(ee31.965173139544905) == 3.590892194141079e6229
W(ee31.752610949621566) == 3.296534240252085e3818
W(ee31.913848146747807) == 1.5268311171822413e5535
W(ee31.640295850532457) == 2.2637793318601247e2948
W(ee31.764948764454818) == 3.5762246079696114e3928
W(ee31.652926931263902) == 2.3139757541974464e3035
W(ee31.929958343490664) == 2.332630066079301e5744
W(ee31.98205373630235) == 2.878867493568092e6476
W(ee31.98283664180519) == 1.3960688507821357e6488
W(ee31.787391560044053) == 8.01963757821285e4136
W(ee31.823874021678865) == 2.7187091896742213e4499
W(ee31.825232704314676) == 3.4104034609250986e4513
W(ee31.863878434083848) == 3.8176698551518697e4933
W(ee31.918276882779058) == 8.276372977284206e5591
W(ee31.669172925011136) == 1.151060360788823e3151
W(ee31.909157710719125) == 5.305882880703211e5475
W(ee31.954588884894793) == 3.7058668964725516e6079
W(ee31.690265691504234) == 7.565092881039769e3307
W(ee31.696486703711212) == 4.0107213474029315e3355
W(ee31.907517771777723) == 1.2214311038222574e5455
Code to generate the above test cases
let count = 0;
while (count < 100) {
	const n = Math.random() * 3 + 30
	const Wn = Decimal.lambertw("ee" + n)
	if (Wn.gt(1e40)) {
		console.log("W(ee"+n+") == "+Wn.toString())
		count++
	}
	else
		count+=(1/1024)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant