| 1 | initial version |
You want to display your polynomial as a polynomial in a, b, c, d, e,
whose coefficients are polynomials in m1, m2, m3, m4, m5.
One way to achieve that is to create another polynomial ring with that kind of structure, and the same variable names; then you can pass the string representation of your polynomial to that ring.
sage: R.<x,y,z,w,u,z1,z2,z3,z4,z5> = PolynomialRing(QQ,10)
sage: pp = (x^2, y^2+x*y, z^2+x*z + y*z, w^2 - w*x+w*y, u^2 + u*x+ u*z + u*w)
sage: S.<a,b,c,d,e,m1,m2,m3,m4,m5> = R.quo(pp)
sage: U.<m1,m2,m3,m4,m5> = QQ[]
sage: V.<a,b,c,d,e> = U[]
sage: q = (a*(m3+m4+m5) + b*(m1+m2+m3+m4) + c*(m1+m3) + d*(m1+m2) + e*m1)^5
sage: V(str(q))
(...)*e^5
So it's some polynomial expression in the mi's times e^5 (not a*b*c*d*e).
| 2 | No.2 Revision |
You want [Edited 2014-12-17]
Running your code:
sage: R.<x,y,z,w,u,z1,z2,z3,z4,z5> = PolynomialRing(QQ,10)
sage: pp = (x^2, y^2+x*y, z^2+x*z + y*z, w^2 - w*x+w*y, u^2 + u*x+ u*z + u*w)
sage: S.<a,b,c,d,e,m1,m2,m3,m4,m5> = R.quo(pp)
sage: q = (a*(m3+m4+m5) + b*(m1+m2+m3+m4) + c*(m1+m3) + d*(m1+m2) + e*m1)^5
sage: q # outputs a polynomial whose monomials are all (monomial in m1 to display your m5) * e^5
...
To get that polynomial as a polynomial in a, b, c, d, e,
whose coefficients are polynomials in m1, m2, m3, m4, m5.
One ,
one way to achieve that is to create another polynomial ring with that
that kind of structure, structure,
and the same variable names; then you can pass
pass the string representation representation
of your polynomial to that ring.
sage: R.<x,y,z,w,u,z1,z2,z3,z4,z5> = PolynomialRing(QQ,10)
sage: pp = (x^2, y^2+x*y, z^2+x*z + y*z, w^2 - w*x+w*y, u^2 + u*x+ u*z + u*w)
sage: S.<a,b,c,d,e,m1,m2,m3,m4,m5> = R.quo(pp)
sage: U.<m1,m2,m3,m4,m5> = QQ[]
sage: V.<a,b,c,d,e> = U[]
sage: U = PolynomialRing(QQ,['m1', 'm2', 'm3', 'm4', 'm5'])
sage: V = PolynomialRing(U, ['a', 'b', 'c', 'd', 'e'])
sage: qq = V(str(q))
sage: qq
(4/19*m1^5 + ... - 60/19*m1*m2*m3*m4*m5)*e^5
But if you know the result is of the form
"(some polynomial in m1 to m5) times a*b*c*d*e",
you don't need the auxiliary polynomial ring. You can just do
sage: f = a*b*c*d*e
sage: f
-1/38*e^5
sage: m = q = (a*(m3+m4+m5) + b*(m1+m2+m3+m4) + c*(m1+m3) + d*(m1+m2) + e*m1)^5
sage: V(str(q))
(...)*e^5
/ f
sage: m
-8*m1^5 - 30*m1^4*m2 - 20*m1^3*m2^2 - 20*m1^4*m3 - 80*m1^3*m2*m3 - 30*m1^2*m2^2*m3 + 30*m1*m2^2*m3^2 + 10*m1^2*m3^3 + 20*m1*m2*m3^3 - 10*m1^4*m4 + 30*m1^2*m2^2*m4 + 60*m1*m2^2*m3*m4 + 30*m1^2*m3^2*m4 + 60*m1*m2*m3^2*m4 + 20*m1^3*m4^2 + 30*m1^2*m2*m4^2 + 30*m1^2*m3*m4^2 + 60*m1*m2*m3*m4^2 + 10*m1^4*m5 + 40*m1^3*m2*m5 + 30*m1^2*m2^2*m5 + 40*m1^3*m3*m5 + 120*m1^2*m2*m3*m5 + 60*m1*m2^2*m3*m5 + 30*m1^2*m3^2*m5 + 60*m1*m2*m3^2*m5 + 40*m1^3*m4*m5 + 60*m1^2*m2*m4*m5 + 60*m1^2*m3*m4*m5 + 120*m1*m2*m3*m4*m5
So it's some polynomial expression in the mi's times e^5 (not a*b*c*d*e).
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.