#5679: fix a bug in solve and polynomial generators
------------------------+---------------------------------------------------
   Reporter:  was       |       Owner:  burcin  
       Type:  defect    |      Status:  new     
   Priority:  major     |   Milestone:  sage-4.7
  Component:  calculus  |    Keywords:          
     Author:            |    Upstream:  N/A     
   Reviewer:            |      Merged:          
Work_issues:            |  
------------------------+---------------------------------------------------
Changes (by kcrisman):

  * upstream:  => N/A


Comment:

 In Sage 4.6.2:
 {{[
 sage: f = symbolic_expression(x0) == 0
 sage: f.solve(x0)
 ---------------------------------------------------------------------------
 TypeError: x0 is not a valid variable.
 sage: f.solve(symbolic_expression(x0))
 [x0 == 0]
 }}}

 This is because
 {{{
         if not isinstance(x, Expression):
             raise TypeError, "%s is not a valid variable."%x
 }}}
 So I guess one could check whether SR(x) is a symbol?
 {{{
 sage: symbolic_expression(x0)._is_symbol()
 True
 }}}

 Incidentally, we never get to the `args[0]` because you are solving a
 single expression, so it goes to `ex.solve(*args)`.  So maybe we should
 check for that...  But in any case the syntax is now
 {{{
 sage: solve([symbolic_expression(x0) == 0, 0==0], [x0, x1, x2])
 ---------------------------------------------------------------------------
 TypeError: x0 is not a valid variable.
 }}}
 which ''does'' raise the error in question.

 But
 {{{
 sage: solve([symbolic_expression(x0) == 0, 0==0], [SR(x0), SR(x1),
 SR(x2)])
 [[x0 == 0, x1 == r2, x2 == r1]]
 }}}

 Weirdly,
 {{{
 sage: solve([symbolic_expression(x0) == 0], SR(x0), SR(x1), SR(x2))
 ([x0 == 0], [1])
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5679#comment:1>
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