#12809: Solve does not give consistent results when a dummy variable is involved
-----------------------------+----------------------------------------------
   Reporter:  afleckenstein  |             Owner:  burcin  
       Type:  defect         |            Status:  new     
   Priority:  major          |         Milestone:  sage-5.0
  Component:  symbolics      |          Keywords:  solve   
Work issues:                 |   Report Upstream:  N/A     
  Reviewers:                 |           Authors:          
  Merged in:                 |      Dependencies:          
   Stopgaps:                 |  
-----------------------------+----------------------------------------------
 When working on another ticket (#11201) that involves documentation for
 the solve function, doing doctests proved to be frustrating. I added to
 the examples section of the docstring, and then multiple tests failed. I
 did some manual testing in sage and noticed a problem:


 {{{
 sage: var('x y')
 (x, y)
 sage: solve(cos(x)*sin(y)==1/2, x+y==0,x,y)
 [[x == 1/4*pi + pi*z6, y == -1/4*pi - pi*z6]]
 }}}


 This is a perfectly valid answer, except that when I tried to solve the
 same equations again, the answer is different:


 {{{
 sage: solve(cos(x)*sin(y)==1/2, x+y==0,x,y)
 [[x == 1/4*pi + pi*z14, y == -1/4*pi - pi*z14]]
 }}}


 This is still mathematically correct.
 If I solve them many more times, z's coefficient keeps going up by 8:


 {{{
 sage: solve(cos(x)*sin(y)==1/2, x+y==0,x,y)
 [[x == 1/4*pi + pi*z22, y == -1/4*pi - pi*z22]]
 sage: solve([cos(x)*sin(x) == 1/2, x+y == 0],x,y)
 [[x == 1/4*pi + pi*z30, y == -1/4*pi - pi*z30]]
 sage: solve([cos(x)*sin(x) == 1/2, x+y == 0],x,y)
 [[x == 1/4*pi + pi*z38, y == -1/4*pi - pi*z38]]
 sage: solve([cos(x)*sin(x) == 1/2, x+y == 0],x,y)
 [[x == 1/4*pi + pi*z46, y == -1/4*pi - pi*z46]]
 sage: solve([cos(x)*sin(x) == 1/2, x+y == 0],x,y)
 [[x == 1/4*pi + pi*z54, y == -1/4*pi - pi*z54]]
 sage: solve([cos(x)*sin(x) == 1/2, x+y == 0],x,y)
 [[x == 1/4*pi + pi*z62, y == -1/4*pi - pi*z62]]
 sage: solve([cos(x)*sin(x) == 1/2, x+y == 0],x,y)
 [[x == 1/4*pi + pi*z70, y == -1/4*pi - pi*z70]]
 sage: solve([cos(x)*sin(x) == 1/2, x+y == 0],x,y)
 [[x == 1/4*pi + pi*z78, y == -1/4*pi - pi*z78]]
 sage: solve([cos(x)*sin(x) == 1/2, x+y == 0],x,y)
 [[x == 1/4*pi + pi*z86, y == -1/4*pi - pi*z86]]
 sage: solve([cos(x)*sin(x) == 1/2, x+y == 0],x,y)
 [[x == 1/4*pi + pi*z94, y == -1/4*pi - pi*z94]]
 }}}


 All still mathematically correct.

 This is a problem when you are trying to add examples to the documentation
 for solve and many doctests fail because the coefficients for the dummy
 variable are shifted up by some integer amount. I have included the file
 expressions_pyx_doctests.txt to show more of what I am talking about. To
 cause this, I added two examples, and the examples that I added were not
 complained about in the doctest. Also, z's coefficient went up by 6 this
 time, different than 8 in the first example.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12809>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to