- **PARI/GP**
(*https://www.mersenneforum.org/forumdisplay.php?f=155*)

- - **How to solve this equation with pari gp ...**
(*https://www.mersenneforum.org/showthread.php?t=25788*)

[QUOTE=R. Gerbicz;552019]Good question, it is not binary search,[/QUOTE]
Methink is some Brent/Newton variation (it computes the tangents, and their Ox intersection to get next point). You may force the "abort" by playing with real precision defaults. Edit: yep, the manual says it uses Brent (draw a secant from a to b, it intersects Ox, that is the new point, it matched with your output, well, [URL="https://en.wikipedia.org/wiki/Brent%27s_method"]Brent Method[/URL] is a bit more complex, but that is the idea, and it should be very easy to implement a Brent(function, a, b, epsilon) to work as intended, give me some minutes for a recursive version...). |

[QUOTE=LaurV;552169]
Edit: yep, the manual says it uses Brent (draw a secant from a to b, it intersects Ox, that is the new point, it matched with your output, well, [/QUOTE] Ok, but for f(x)=x^3 it is weaker than the binary search. Just try this: [CODE]cnt=0;solve(x=-1,2,cnt+=1;print(cnt" "x);x^3)[/CODE] So it is doing at most 259 iterations. |

I thought the problem would go away if you shifted away from zero (where the floating point number representation can shift almost arbitrarily), but it still cannot do any of:
[CODE]solve(x=-1, 2, x^3) solve(x=-1+0.1, 2+0.1, (x-0.1)^3) - 0.1 solve(x=-1+0.1, 2+0.1, print(x);(x-0.1)^3) - 0.1 [/CODE] with usual realprecision default. /JeppeSN |

All times are UTC. The time now is 14:13. |

Powered by vBulletin® Version 3.8.11

Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.