1 | initial version |
maxima allows to collect multiple terms, so it is possible to do so in Sage using:
sage: f = 4*x*y + x*z + 20*y^2 + 21*y*z + 4*z^2 + x^2*y^2*z^2
sage: fm = f.maxima_methods()
sage: fm.collectterms(x,y)
x^2*y^2*z^2 + 4*x*y + x*z + 20*y^2 + 21*y*z + 4*z^2
sage: fm.collectterms(x)
x^2*y^2*z^2 + (4*y + z)*x + 20*y^2 + 21*y*z + 4*z^2
is this what yo need?
2 | mention the function operands() |
maxima allows to collect multiple terms, so it is possible to do so in Sage using:
sage: f = 4*x*y + x*z + 20*y^2 + 21*y*z + 4*z^2 + x^2*y^2*z^2
sage: fm = f.maxima_methods()
sage: fm.collectterms(x,y)
x^2*y^2*z^2 + 4*x*y + x*z + 20*y^2 + 21*y*z + 4*z^2
sage: fm.collectterms(x)
x^2*y^2*z^2 + (4*y + z)*x + 20*y^2 + 21*y*z + 4*z^2
is from there you could use the operands() method to simplify each term separately. Is this what yo need?enough?
Can you assume that your expression is polynomial in x and y?
3 | No.3 Revision |
maxima allows to collect multiple terms, so it is possible to do so in Sage using:
sage: f = 4*x*y + x*z + 20*y^2 + 21*y*z + 4*z^2 + x^2*y^2*z^2
sage: fm = f.maxima_methods()
sage: fm.collectterms(x,y)
x^2*y^2*z^2 + 4*x*y + x*z + 20*y^2 + 21*y*z + 4*z^2
sage: fm.collectterms(x)
x^2*y^2*z^2 + (4*y + z)*x + 20*y^2 + 21*y*z + 4*z^2
from there you could use the operands() method to simplify each term separately. Is this what enough?
Can you assume that your expression is polynomial in x and y?