Opened 13 years ago
Closed 9 years ago
#9046 closed defect (duplicate)
bug in collect and/or term ordering in symbolics
Reported by: | Paul Zimmermann | Owned by: | Burcin Erocal |
---|---|---|---|
Priority: | minor | Milestone: | sage-duplicate/invalid/wontfix |
Component: | symbolics | Keywords: | pynac |
Cc: | Karl-Dieter Crisman | Merged in: | |
Authors: | Reviewers: | Burcin Erocal, Paul Zimmermann | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | #9880 | Stopgaps: |
Description (last modified by )
This seems a bug (note the instances of -x^2
and x^2
):
var('a b x y z') sage: p = -a*x^3 - a*x*y^2 + 2*b*x^2*y + 2*y^3 + x^2*z + y^2*z + x^2 + y^2 + a*x sage: p.collect(x) -a*x^3 + (2*b*y + z + 1)*x^2 - x^2 - (a*y^2 - a)*x + x^2 + 2*y^3 + y^2*z + y^2
Change History (13)
comment:1 Changed 13 years ago by
Keywords: | pynac added |
---|
comment:2 Changed 12 years ago by
Cc: | Karl-Dieter Crisman added |
---|---|
Priority: | critical → minor |
This is not critical.
comment:3 Changed 10 years ago by
Component: | calculus → symbolics |
---|---|
Description: | modified (diff) |
Summary: | missing documentation and bug in collect → bug in collect and/or term ordering in symbolics |
It turns out that #11839 was opened and did the first part of this ticket, including documenting the expand()
issue.
However, the bug remains, so I'll just change this ticket to be about it.
comment:4 Changed 10 years ago by
With the new description, this is probably a duplicate of #9880. I will check if the pynac changes for that ticket fix this one.
comment:6 Changed 10 years ago by
Milestone: | sage-5.1 → sage-duplicate/invalid/wontfix |
---|---|
Reviewers: | → Burcin Erocal |
Status: | new → needs_review |
This is a duplicate of #9880. With the Pynac patch queue and patches listed on #9880, I get:
sage: var('a b x y z') (a, b, x, y, z) sage: p = -a*x^3 - a*x*y^2 + 2*b*x^2*y + 2*y^3 + x^2*z + y^2*z + x^2 + y^2 + a> sage: p.collect(x) -a*x^3 + (2*b*y + z + 1)*x^2 + 2*y^3 + y^2*z - (a*y^2 - a)*x + y^2
We should close this after adding it as a doctest to #9880.
comment:7 Changed 10 years ago by
Status: | needs_review → positive_review |
---|
Doctest is in attachment:trac_9880-doctest_for_9046.patch:ticket:9880. This can be closed now.
comment:8 Changed 10 years ago by
Reviewers: | Burcin Erocal → Burcin Erocal, Paul Zimmermann |
---|---|
Status: | positive_review → needs_work |
Work issues: | → correct doctests |
Burcin,
first the ticket number is wrong (13107 instead of 9046) then the input p was mangled
(ends with a>
instead of a*x
).
Paul
comment:9 Changed 10 years ago by
Status: | needs_work → needs_review |
---|
I replaced the patch attached to #9880:
attachment:trac_9880-doctest_for_9046.patch:ticket:9880
I hope I got it right this time. Sorry for the noise.
comment:10 Changed 10 years ago by
comment:11 Changed 10 years ago by
Dependencies: | → #9880 |
---|
comment:12 Changed 9 years ago by
Status: | needs_review → positive_review |
---|
That ticket has been merged, so I think this can be closed.
comment:13 Changed 9 years ago by
Resolution: | → duplicate |
---|---|
Status: | positive_review → closed |
Work issues: | correct doctests |
Here is the same session using GiNaC directly via
ginsh
:It seems that one needs to call
expand()
explicitly before callingcollect()
. I think this should just be documented in the docstring.The problem with
-x^2 + x^2
appearing in the output is probably a bug I introduced while playing with the ordering of the terms. I will take a look at it when I find a chance. It's likely to be later than a week though.