#9046: bug in collect and/or term ordering in symbolics
-----------------------------+----------------------------------------------
Reporter: zimmerma | Owner: burcin
Type: defect | Status: new
Priority: minor | Milestone: sage-5.1
Component: symbolics | Resolution:
Keywords: pynac | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
-----------------------------+----------------------------------------------
Changes (by kcrisman):
* component: calculus => symbolics
Old description:
> the documentation from {{{collect}}} does not say what this function
> does. It should be documented.
>
> Also, if it does what its name suggests, i.e., collect terms with
> same exponent in 's', the following example shows that it seems that
> the user should call {{{expand}}} before, since terms in {{{x^3}}}
> are not properly collected:
> {{{
> sage: (x^2+(y-x^2)*(y+x)).collect(x)
> -(x + y - 1)*x^2 + x^3 - (x^2 - y)*x + y^2
> sage: (x^2+(y-x^2)*(y+x)).expand().collect(x)
> -(y - 1)*x^2 - x^3 + x*y + y^2
> }}}
>
> Finally 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
New description:
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
}}}
--
Comment:
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.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9046#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.