Opened 13 years ago
Closed 12 years ago
#2360 closed defect (fixed)
[with patch, positive review] Strange Polynomial substitution problem
Reported by: | jbmohler | Owned by: | somebody |
---|---|---|---|
Priority: | major | Milestone: | sage-3.3 |
Component: | basic arithmetic | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
I made a stupid error plugging a list into a polynomial, but it uncovered this very strange bug:
sage: R.<x,y,z,u,v,w>=ZZ[] sage: P.<a>=ZZ[] sage: e=[x^2,y^3] sage: f=6*a^4 sage: f(x) 6*x^4 sage: f(e) Exception exceptions.TypeError: "can't multiply sequence by non-int of type 'list'" in 'sage.rings.polynomial.polynomial_compiled.sqr_pd.eval' ignored Exception exceptions.TypeError: "unsupported operand type(s) for *: 'NoneType' and 'NoneType'" in 'sage.rings.polynomial.polynomial_compiled.sqr_pd.eval' ignored Exception exceptions.TypeError: "unsupported operand parent(s) for '*': 'Integer Ring' and '<type 'NoneType'>'" in 'sage.rings.polynomial.polynomial_compiled.mul_pd.eval' ignored sage: f(x) Exception exceptions.TypeError: "can't multiply sequence by non-int of type 'list'" in 'sage.rings.polynomial.polynomial_compiled.sqr_pd.eval' ignored Exception exceptions.TypeError: "unsupported operand type(s) for *: 'NoneType' and 'NoneType'" in 'sage.rings.polynomial.polynomial_compiled.sqr_pd.eval' ignored Exception exceptions.TypeError: "unsupported operand parent(s) for '*': 'Integer Ring' and '<type 'NoneType'>'" in 'sage.rings.polynomial.polynomial_compiled.mul_pd.eval' ignored
Notice that the plugging in the list seemed to ruin the polynomial good and proper.
Attachments (1)
Change History (8)
comment:1 Changed 13 years ago by
- Component changed from algebraic geometry to basic arithmetic
- Milestone set to sage-2.10.3
- Owner changed from was to somebody
comment:2 Changed 13 years ago by
comment:3 Changed 12 years ago by
- Summary changed from Strange Polynomial substitution problem to [with patch, needs review] Strange Polynomial substitution problem
The attached patch fixes the issue. Credit goes to Tom Boothby too.
comment:4 Changed 12 years ago by
- Summary changed from [with patch, needs review] Strange Polynomial substitution problem to [with patch, needs work] Strange Polynomial substitution problem
The patch fixes the issue, but I'd rather have the original error about multiplying lists propagate up instead of a generic "RuntimeError?: Polynomial evaluation error in val()!"
Changed 12 years ago by
comment:5 Changed 12 years ago by
- Summary changed from [with patch, needs work] Strange Polynomial substitution problem to [with patch, needs review] Strange Polynomial substitution problem
I updated the patch.
comment:6 Changed 12 years ago by
- Summary changed from [with patch, needs review] Strange Polynomial substitution problem to [with patch, positive review] Strange Polynomial substitution problem
OK, that looks good.
comment:7 Changed 12 years ago by
- Milestone changed from sage-3.4.1 to sage-3.3
- Resolution set to fixed
- Status changed from new to closed
Merged in Sage 3.3.alpha2.
Cheers,
Michael
Note: See
TracTickets for help on using
tickets.
Ah, it's even easier. No second mpoly ring required!