Opened 5 years ago
Closed 5 years ago
#17128 closed defect (fixed)
Problem with solution_dict=True and solving for multiple variables
Reported by:  jhpalmieri  Owned by:  

Priority:  major  Milestone:  sage6.4 
Component:  symbolics  Keywords:  
Cc:  Merged in:  
Authors:  Miguel Marco  Reviewers:  Ralf Stephan 
Report Upstream:  N/A  Work issues:  
Branch:  b26dbd4 (Commits)  Commit:  b26dbd46534be67d92bd808d8f45a6519aac957e 
Dependencies:  Stopgaps: 
Description
This bug was reported at http://ask.sagemath.org/question/24446/problemwithsolution_dicttrue/:
sage: var('x y') (x, y) sage: sol=solve(x + y, [x, y], solution_dict=True)  AttributeError Traceback (most recent call last) <ipythoninput2d24a5a0d9f55> in <module>() > 1 sol=solve(x + y, [x, y], solution_dict=True) /Users/palmieri/Desktop/Sage_stuff/git/sage/local/lib/python2.7/sitepackages/sage/symbolic/relation.pyc in solve(f, *args, **kwds) 732 from sage.symbolic.expression import is_Expression 733 if is_Expression(f): # f is a single expression > 734 ans = f.solve(*args,**kwds) 735 return ans 736 /Users/palmieri/Desktop/Sage_stuff/git/sage/local/lib/python2.7/sitepackages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.solve (build/cythonized/sage/symbolic/expression.cpp:47600)() AttributeError: 'list' object has no attribute 'left'
I think this was introduced in #16531.
Change History (10)
comment:1 Changed 5 years ago by
comment:2 Changed 5 years ago by
 Branch set to u/mmarco/ticket/17128
 Created changed from 10/10/14 05:57:28 to 10/10/14 05:57:28
 Modified changed from 10/10/14 12:52:15 to 10/10/14 12:52:15
comment:3 Changed 5 years ago by
 Commit set to 88d0e11df6fdfdc6e11c1a9b30e09265c5e3c5fa
This should fix it.
New commits:
88d0e11  Fix error converting solutions to dict when solving for multiple variables.

comment:4 Changed 5 years ago by
 Status changed from new to needs_review
comment:5 Changed 5 years ago by
 Branch changed from u/mmarco/ticket/17128 to public/17128
comment:6 Changed 5 years ago by
 Commit changed from 88d0e11df6fdfdc6e11c1a9b30e09265c5e3c5fa to 06d61ab93c522511d2e4c60e9953931f2190d858
 Reviewers set to Ralf Stephan
 Status changed from needs_review to positive_review
comment:7 Changed 5 years ago by
 Status changed from positive_review to needs_work
variable sort order is random:
sage t long src/sage/symbolic/expression.pyx ********************************************************************** File "src/sage/symbolic/expression.pyx", line 9448, in sage.symbolic.expression.Expression.solve Failed example: f.solve([x, y], solution_dict=True) Expected: [{x: r..., y: r...}] Got: [{y: r8, x: r8}] **********************************************************************
comment:8 Changed 5 years ago by
 Commit changed from 06d61ab93c522511d2e4c60e9953931f2190d858 to b26dbd46534be67d92bd808d8f45a6519aac957e
comment:9 Changed 5 years ago by
 Status changed from needs_work to positive_review
comment:10 Changed 5 years ago by
 Branch changed from public/17128 to b26dbd46534be67d92bd808d8f45a6519aac957e
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
The problem arises in the conversion to dictionary form. This works ok:
It should be easy to fix.