guess_exact_value(float(2*sqrt(2))) => 2.8284271247461907
guess_exact_value can't always give a symbolic result, but it fails in too many trivial cases: I'd have thought that n*sqrt(m), n+sqrt(m), sqrt(m)+sqrt(n), etc. would almost always succeed for small m, n. But in fact they often fail. Is that because many cases are "close calls", because the algorithm isn't very powerful, or because our parameter settings aren't very good?
Maxima 5.47.0 SBCL 2.4.9
for i:2 thru 5 do for j:i+1 thru 10 do if floatnump(guess_exact_value(ff:float(sqrt(i)+sqrt(j)))) then print([i,j,ff]);
[2, 4, 3.414213562373095]
[2, 6, 3.863703305156273]
[2, 7, 4.059964873437686]
[2, 9, 4.414213562373095]
[2, 10, 4.576491222541475]
[3, 4, 3.732050807568877]
[3, 6, 4.1815405503520555]
[3, 7, 4.377802118633468]
[3, 8, 4.560477932315068]
[3, 9, 4.732050807568877]
[3, 10, 4.894328467737257]
[4, 5, 4.23606797749979]
[4, 7, 4.645751311064591]
[4, 8, 4.828427124746191]
[4, 10, 5.16227766016838]
[5, 6, 4.685557720282968]
[5, 7, 4.8818192885643805]
[5, 8, 5.0644951022459805]
[5, 9, 5.23606797749979]
[5, 10, 5.39834563766817]
for i:2 thru 10 do for j:i+1 thru 10 do if floatnump(guess_exact_value(ff:float(i+sqrt(j)))) then print([i,j,ff]);
[2, 3, 3.732050807568877]
[2, 5, 4.23606797749979]
[2, 7, 4.645751311064591]
[2, 8, 4.828427124746191]
[2, 10, 5.16227766016838]
[3, 5, 5.23606797749979]
[3, 6, 5.449489742783178]
[3, 7, 5.645751311064591]
[3, 8, 5.828427124746191]
[3, 10, 6.16227766016838]
[4, 5, 6.23606797749979]
[4, 6, 6.449489742783178]
[4, 8, 6.828427124746191]
[4, 10, 7.16227766016838]
[5, 6, 7.449489742783178]
[5, 7, 7.645751311064591]
[5, 8, 7.828427124746191]
[5, 10, 8.16227766016838]
[6, 7, 8.64575131106459]
[6, 8, 8.828427124746192]
[6, 10, 9.16227766016838]
[7, 8, 9.828427124746192]
[7, 10, 10.16227766016838]
[8, 10, 11.16227766016838]
[9, 10, 12.16227766016838]
Stavros, I don't see that output; the loop doesn't print anything in either case, and trying similar expressions seems to show
guess_exact_valuereturns reasonable results (not exactly the same as the input, maybe factored differently or, in some cases, with nested sqrts).I tried it with 5.47.0 and with a recent build, on Linux in both cases. What does
build_info()say on your system?What do you get if you say
batch("rtest_pslq", test)? That has a number of simple examples forguess_exact_value. I get no errors; do any of the examples work when you try it?I just tried on cygwin/clisp/windows11 with 5.47.0 and git head. Same results as Robert.
I'm closing this as not-a-bug since we weren't able to reproduce it. We can reopen it if someone figures out how to reproduce it.
Sorry, I had apparently changed fpprec and forgotten that it affects guess_exact_value.