-
Notifications
You must be signed in to change notification settings - Fork 46
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
Infinite height tetration leading to wrong fixed point for a range of value. #36
Comments
Note: 60.35084336706522 is a repulsive fixed point. In Double, it will reach Infinity after 29 iterations(meaning it is slightly too bigger than it actually is). |
Yeah, the implementation of Lambert W I copied has some other funky precision issues and it's non-obvious how to fix it (or its consequences). |
It is calculating correctly(technically), but on the wrong branch. It is possible to see here that the code is calculating W-1 branch, however for our purposes it is supposed to be W0 instead. |
Thanks, these look like useful resources. I don't think I have enough focus to think about math, presently; if you happen to beat me to a better working implementation, feel free to make a pull request. Otherwise I may get to it in the future. |
Ok, I will make a PR when I get to it because I'm going to |
Cool. Thank you for your continuing large numbers work! |
Tested x^^Infinity for 0.06<=x<=1.44. Tested using this code: The new function for var f_lambertw = function(z, tol = 1e-10) {
var w;
var wn;
if (!Number.isFinite(z)) { return z; }
if (z === 0)
{
return z;
}
if (z === 1)
{
return OMEGA;
}
if (z < 10)
{
w = 0;
}
else
{
w = Math.log(z)-Math.log(Math.log(z));
}
for (var i = 0; i < 100; ++i)
{
wn = (z * Math.exp(-w) + w * w)/(w + 1);
if (Math.abs(wn - w) < tol*Math.abs(wn))
{
return wn;
}
else
{
w = wn;
}
}
throw Error("Iteration failed to converge: " + z);
//return Number.NaN;
} Each line of the output is in the form: Old function:
New function:
What do you think? |
For 1.44<=x<e^(1/e) in increments of 0.0001. Old:
New:
|
And for 1.4446<=x<e^(1/e) in increments of 0.000001. Old:
New:
|
And for that matter, 1.444667<=x<e^(1/e) in increments of 0.00000001. Old:
New:
It is obvious that for where x^^Infinity converges, the new method is better than the old one. I have no idea for the other parts, so I will leave |
Also, the minified file you are using is generated by UglifyJS 3, I assume? |
Wait, I got different results... |
Oh, I can answer that part - I run it through https://babeljs.io/repl then I run THAT through https://javascript-minifier.com/ . I don't know if that's the best way to do it, but no one ever complained. |
Ok, thanks! |
May I ask the options you use for Babel? |
es2015/stage-2/react, I think. If I ever changed it I have no memory of it. |
Thank you, now I understand how the beginning of the code is way it is. |
Thanks for your investigation work, I'm happy with this, merged. |
Decimal.tetrate
calculates infinite height tetrations using Lambert's W. However, for some reason that I don't really know, for bases between ~1.0703 to e^(1/e), it will cause it to go to unexpectedly high values. It is in fact a fixed point for the exponential function, however, it is not the same as taking the limit as the height goes to infinity.The text was updated successfully, but these errors were encountered: