On Sun, Aug 9, 2009 at 2:03 PM, Dr. David Kirkby <david.kir...@onetel.net>wrote:
> > Seen with Sage 4.1.1.rc0, with updated ECL 9.8.1 and Maxima 5.19.0. > > Should this be reported to the Maxima list? > > I've not created a trac ticket for this, as I don't know enough to fill > it in properly. > > File > > "/export/home/drkirkby/sage/sage-4.1.1.rc0/devel/sage/sage/symbolic/expression.pyx", > line 5329: > sage: solve(Q*sqrt(Q^2 + 2) - 1,Q) > Expected: > [Q == 1/sqrt(-sqrt(2) + 1), Q == 1/sqrt(sqrt(2) + 1)] > Got: > [Q == 1/sqrt(sqrt(2) + 1)] This seems like a bug in Maxima to me, at first glance. For comparison, here is what Mathematica does (which is the same as Sage right now): sage: var('Q') Q sage: m = mathematica(Q*sqrt(Q^2 + 2) == 1); m Q*Sqrt[2 + Q^2] == 1 sage: m.Solve(Q) {{Q -> Sqrt[-1 + Sqrt[2]]}, {Q -> (-I)*Sqrt[1 + Sqrt[2]]}} sage: m.NSolve(Q) {{Q -> 0. - 1.5537739740300396*I}, {Q -> 0.6435942529055826}} sage: f = Q*sqrt(Q^2 + 2) - 1 sage: s = solve(Q*sqrt(Q^2 + 2) - 1,Q, solution_dict=True) sage: N(s[0][Q]) 9.51412161947174e-17 - 1.55377397403004*I sage: N(s[1][Q]) 0.643594252905583 So I think this is a bug. It should return both solutions, but is only returning the one real solution. Note that this is the behavior of the default Maxima mode even in 5.16.3. sage: !maxima Maxima 5.16.3 http://maxima.sourceforge.net Using Lisp ECL 9.4.1 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) solve(Q*sqrt(Q^2+2)-1,Q) ; 1 (%o1) [Q = ------------] 2 sqrt(Q + 2) In fact, I can't coerce Maxima to return both solutions *no matter* what I do, setting domain:complex, etc. Notice that in fact what Maxima does is return the "solution" 'Q == 1/sqrt(Q^2 + 2)', which is no solution at all since Q is in the right hand side. Sage (in expression.pyx in the "if explicit_solutions is not False:" part of the code around line 5318), looks at each solution, then calls Maxima's to_poly_solve on it. Here to_poly_solve is a function that is loaded when the maxima interface initialization code is run, i.e., "load(topoly_solver)" is executed. The maxima interface used by Sage's calculus code is started in calculus.py with this line: maxima = Maxima(init_code = ['display2d:false; domain: complex; keepfloat: true; load(topoly_solver)'], script_subdirectory=None) So, my conclusion is that the topoly_solve package is somehow broken in the new version of Maxima. In Maxima 5.16.3 we have: sage: !maxima Maxima 5.16.3 http://maxima.sourceforge.net Using Lisp ECL 9.4.1 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) load(topoly_solver); domain:complex; (%o1) /Users/wstein/sage/build/64bit/sage/local/share/maxima/5.16.3/share/cont\ rib/topoly_solver.mac (%i2) (%o2) complex (%i3) to_poly_solve(Q = 1/sqrt(Q^2 + 2),Q); Assuming that sqrt(Q^2+2) # 0 (%o3) [[Q = - sqrt(- sqrt(2) - 1)], [Q = sqrt(sqrt(2) - 1)]] Notice that we got both solutions! Does exactly the same input in Maxima 5.19 not work right? William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---