#8553: Minor bugs in solve() if dictionary result requested
-------------------------------------------------------------------------------+
   Reporter:  leif                                                             
|          Owner:  leif                          
       Type:  defect                                                           
|         Status:  positive_review               
   Priority:  trivial                                                          
|      Milestone:  sage-4.7.1                    
  Component:  symbolics                                                        
|       Keywords:  solve, solution_dict, beginner
Work_issues:                                                                   
|       Upstream:  N/A                           
   Reviewer:  Harald Schilly, Mike Hansen, Burcin Erocal, Karl-Dieter Crisman  
|         Author:  Leif Leonhardy                
     Merged:                                                                   
|   Dependencies:                                
-------------------------------------------------------------------------------+
Changes (by kcrisman):

  * status:  needs_work => positive_review
  * reviewer:  Harald Schilly, Mike Hansen, Burcin Erocal => Harald
               Schilly, Mike Hansen, Burcin Erocal, Karl-
               Dieter Crisman
  * milestone:  sage-4.7 => sage-4.7.1


Old description:

> {{{solve()}}} raises an {{{IndexError}}} on empty solutions if a list of
> solution ''dictionaries'' is requested.
>
> The description/examples may mislead w.r.t. the result type.

New description:

 {{{solve()}}} raises an {{{IndexError}}} on empty solutions if a list of
 solution ''dictionaries'' is requested.

 The description/examples may mislead w.r.t. the result type.


 ----

 Apply [attachment:trac_8553_solve_fix_IndexError.3.patch] and
 [attachment:trac_8553-review.patch].

--

Comment:

 Replying to [comment:30 leif]:
 > Replying to [comment:28 burcin]:
 > > Can you review my changes BTW?
 >
 > {{{m.to_poly_solve(variables)}}} might be called twice.

 It is, but only in the unusual situation that Maxima's solve gave an error
 and `to_poly_solve` gave the empty list.  More to the point, this was
 there before, and should be a different ticket.

 > Btw, I think the patch should be finally reviewed by someone else, not
 me, as I'm one of the authors.
 >
 Not at all - usually it is appropriate to review a reviewer patch.  This
 reviewer patch really is pretty minimally invasive, and in fact provides a
 much more useful error message.

 It is true that
 {{{
 sage: solve(x==1,x,solution_dict=int(3))
 [{x: 1}]
 sage: solve([0==1],x,solution_dict=int(3))
 []
 sage: solve(0==1,x,solution_dict=int(3))
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /Users/karl-dietercrisman/Downloads/sage-4.7.rc1/<ipython console> in
 <module>()

 /Users/karl-dietercrisman/Downloads/sage-4.7.rc1/local/lib/python2.6/site-
 packages/sage/symbolic/relation.pyc in solve(f, *args, **kwds)
     652
     653     if not isinstance(f, (list, tuple)):
 --> 654         raise TypeError("The first argument must be a symbolic
 expression or a list of symbolic expressions.")
     655
     656     if len(f)==1 and is_Expression(f[0]):

 TypeError: The first argument must be a symbolic expression or a list of
 symbolic expressions.
 }}}
 which is not ideal.  However, this is still better behavior than the
 mysterious message about bools and len before, so that could be another
 ticket.

 In any case, this (somewhat surprisingly) still applies fine to 4.7.rc2!
 And does what it says.  And passes tests. Positive review.

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