mersenneforum.org How to solve this equation with pari gp ...
 User Name Remember Me? Password
 Register FAQ Search Today's Posts Mark Forums Read

2020-08-01, 03:23   #12
LaurV
Romulan Interpreter

Jun 2011
Thailand

25·5·59 Posts

Quote:
 Originally Posted by R. Gerbicz Good question, it is not binary search,
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, Brent Method 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...).

Last fiddled with by LaurV on 2020-08-01 at 03:50

2020-08-01, 10:03   #13
R. Gerbicz

"Robert Gerbicz"
Oct 2005
Hungary

2·733 Posts

Quote:
 Originally Posted by LaurV 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,
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)
So it is doing at most 259 iterations.

 2020-08-16, 11:02 #14 JeppeSN     "Jeppe" Jan 2016 Denmark 23·3·7 Posts 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 with usual realprecision default. /JeppeSN

 Thread Tools

 Similar Threads Thread Thread Starter Forum Replies Last Post JM Montolio A Miscellaneous Math 18 2018-03-09 15:32 ixfd64 Puzzles 4 2011-03-30 12:25 flouran Miscellaneous Math 23 2009-01-04 20:03 davar55 Puzzles 3 2008-10-09 00:35 davar55 Puzzles 52 2007-06-26 21:41

All times are UTC. The time now is 13:00.

Thu May 6 13:00:59 UTC 2021 up 28 days, 7:41, 0 users, load averages: 1.29, 1.61, 1.76

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.