Opened 2 years ago
Closed 21 months ago
#31452 closed defect (fixed)
Problem with solution_dict in solve
Reported by: | gh-GMS103 | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.4 |
Component: | algebra | Keywords: | |
Cc: | chapoton | Merged in: | |
Authors: | Travis Scrimshaw | Reviewers: | Frédéric Chapoton |
Report Upstream: | N/A | Work issues: | |
Branch: | 3c04187 (Commits, GitHub, GitLab) | Commit: | 3c041875405b308975c53bd7782a001cfec7d0aa |
Dependencies: | Stopgaps: |
Description
This is with
┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.2, Release Date: 2020-10-24 │ │ Using Python 3.8.5. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘
All of these work as expected:
sage: solve(x==3,x) sage: solve([x==3],x) sage: solve([x==3],[x]) sage: solve(x==3,[x]) sage: solve(x==3,x,solution_dict=True) sage: solve([x==3],x,solution_dict=True)
So I wonder why these give an error:
sage: solve(x==3,[x],solution_dict=True) sage: solve([x==3],[x],solution_dict=True) [...] TypeError: 'sage.symbolic.expression.Expression' object is not iterable
I am sure you have guessed: I am trying to do this in a program where the number of equations and the number of variables are variable.
Is it necessary to test for the case where there is only one variable? I hope not.
Change History (7)
comment:1 Changed 21 months ago by
Milestone: | sage-9.3 → sage-9.4 |
---|
comment:2 Changed 21 months ago by
Authors: | → Travis Scrimshaw |
---|---|
Branch: | → public/symbolics/solution_dict_list-31452 |
Commit: | → 3c041875405b308975c53bd7782a001cfec7d0aa |
Status: | new → needs_review |
Simple corner case. I also fix this while I am at it:
sage: solve([x==3], x, solution_dict=True, algorithm='sympy') [x == 3] sage: solve([x==3, y==1], [x,y], solution_dict=True, algorithm='sympy') # good [{x: 3, y: 1}]
New commits:
3c04187 | Fixing single function and variable with solution_dict solve() corner case.
|
comment:4 Changed 21 months ago by
Reviewers: | → Frédéric Chapoton |
---|---|
Status: | needs_review → positive_review |
ok
comment:7 Changed 21 months ago by
Branch: | public/symbolics/solution_dict_list-31452 → 3c041875405b308975c53bd7782a001cfec7d0aa |
---|---|
Resolution: | → fixed |
Status: | positive_review → closed |
Note: See
TracTickets for help on using
tickets.
Moving to 9.4, as 9.3 has been released.