On Oct 12, 6:37 pm, Robert Samal <[email protected]> wrote: > I observed that solve behaves inconsistently in the following regards: > > sage: solve([x==1,x==-1],x) > [] > > (this is as expected) > However: > > solve([x==1,x==-1],x, solution_dict=True) > > produces an error message. Easy to live with, but I was scared when I > first saw it :-). > > It should be easy to correct, as the message reveals that the function > is trying to look at the 0-th > element of an empty list ... > > /data/local/sage/local/lib/python2.6/site-packages/sage/symbolic/ > relation.pyc in solve(f, *args, **kwds) > 672 sol_list = string_to_list_of_solutions(repr(s)) > 673 if 'solution_dict' in kwds and > kwds['solution_dict']==True: > --> 674 if isinstance(sol_list[0], list): > 675 sol_dict=[dict([[eq.left(),eq.right()] for eq > in solution]) > 676 for solution in sol_list]
Yup. solve() probably needs a general overhaul (and has for a while), but no one has had the time to do so. With that in mind, could you open a ticket on the Trac server for this issue and point out the solution? (If you are really ambitious, you can contribute a patch as well!) Thanks! - kcrisman -- 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-support URL: http://www.sagemath.org
