Opened 11 years ago
Closed 10 years ago
#11618 closed defect (fixed)
solve with solution_dict=True doesn't always return a list
Reported by: | mhampton | Owned by: | burcin |
---|---|---|---|
Priority: | major | Milestone: | sage-4.7.2 |
Component: | symbolics | Keywords: | solve, solution_dict |
Cc: | kcrisman | Merged in: | sage-4.7.2.alpha2 |
Authors: | Leif Leonhardy | Reviewers: | Karl-Dieter Crisman |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | #8553 | Stopgaps: |
Description (last modified by )
As pointed out in a post on sage-support:
var('x') g(x)=0 print solve(g(x)==0,x) print solve(g(x)==0,x,solution_dict=True)
gives
[x == r1] {x: r1}
It should be [{x: r1}]
to be consistent.
Attachments (1)
Change History (9)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
- Status changed from new to needs_review
The attached patch fixes the inconsistency and adds a doctest for the case given.
I've removed superfluous parentheses (and white space) and also converted some tabs to spaces. (I thought the merge script would reject patches introducing new tabs after all got converted a while ago.)
comment:3 follow-up: ↓ 4 Changed 11 years ago by
Hmmm,
ans = [ {x: self.parent().var('r1')} ]
would perhaps have been a bit more readable...
comment:4 in reply to: ↑ 3 Changed 11 years ago by
Replying to leif:
[...] would perhaps have been a bit more readable.
I've updated the patch to directly construct the solution dictionary.
(Leif doesn't work without coffee.)
Hey patchbot, apply: trac_11618-fix_solution_dict_for_infinitely_many_solutions.sagelib.patch!
comment:5 Changed 11 years ago by
- Dependencies set to #8553
The dependency I've added is (more or less) just for the patchbot. (#8553 was merged into Sage 4.7.1.alpha2.)
comment:6 Changed 11 years ago by
- Cc kcrisman added
Thanks for posting this patch - I'll try to take a look at this (relatively) soon, as it looks straightforward.
comment:7 Changed 10 years ago by
- Description modified (diff)
- Reviewers set to Karl-Dieter Crisman
- Status changed from needs_review to positive_review
Patch looks good. Performs as advertised. Thanks!
comment:8 Changed 10 years ago by
- Merged in set to sage-4.7.2.alpha2
- Resolution set to fixed
- Status changed from positive_review to closed
Yep:
A doctest for a similar case got deleted by a reviewer, which still works though:
And also the following works as expected:
(Sage 4.7.1.{alpha2,rc0})