# Computations in a Quotient Ring

I'm trying to do some computations in a quotient ring in Sage, and I'm having some trouble. For example:

Working with the ring:

R.<x,y,z,w,u,z1,z2,z3,z4,z5> = PolynomialRing(QQ,10)
S.<a,b,c,d,e,m1,m2,m3,m4,m5> = R.quo((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))


I want to compute (a*(m3+m4+m5) + b*(m1+m2+m3+m4) + c*(m1+m3) + d*(m1+m2) + e*m1)^5

where I'm thinking about m1, m2, m3, m4, and m5 as arbitrary coefficients. When I type this in it returns

4/19*e^5*m1^5 + 15/19*e^5*m1^4*m2 + 10/19*e^5*m1^3*m2^2 +
10/19*e^5*m1^4*m3 + 40/19*e^5*m1^3*m2*m3 + 15/19*e^5*m1^2*m2^2*m3 -
15/19*e^5*m1*m2^2*m3^2 - 5/19*e^5*m1^2*m3^3 - 10/19*e^5*m1*m2*m3^3 +
5/19*e^5*m1^4*m4 - 15/19*e^5*m1^2*m2^2*m4 - 30/19*e^5*m1*m2^2*m3*m4 -
15/19*e^5*m1^2*m3^2*m4 - 30/19*e^5*m1*m2*m3^2*m4 - 10/19*e^5*m1^3*m4^2 -
15/19*e^5*m1^2*m2*m4^2 - 15/19*e^5*m1^2*m3*m4^2 -
30/19*e^5*m1*m2*m3*m4^2 - 5/19*e^5*m1^4*m5 - 20/19*e^5*m1^3*m2*m5 -
15/19*e^5*m1^2*m2^2*m5 - 20/19*e^5*m1^3*m3*m5 - 60/19*e^5*m1^2*m2*m3*m5
- 30/19*e^5*m1*m2^2*m3*m5 - 15/19*e^5*m1^2*m3^2*m5 -
30/19*e^5*m1*m2*m3^2*m5 - 20/19*e^5*m1^3*m4*m5 - 30/19*e^5*m1^2*m2*m4*m5
- 30/19*e^5*m1^2*m3*m4*m5 - 60/19*e^5*m1*m2*m3*m4*m5


However, this is also equivalent to (some expression of mi's)*a*b*c*d*e.

I want it in this form, because for the problem I'm working on I need this coefficient in front of a*b*c*d*e. But I'm not sure how to ask Sage to convert it to this form? For example, "solve" doesn't seem to work in a quotient ring.

(I'm sorry if this is a silly question. I'm new to Sage!)

edit retag close merge delete

To display lines of code, either indend them four spaces, or select them and click the "code" button (the one with "010 101"). To display fragments of code in a text paragraph, use backticks.

( 2014-12-16 09:39:38 -0500 )edit

Sort by ยป oldest newest most voted

[Edited 2014-12-17]

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 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 way 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: 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 / 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


and that's the coefficient you were looking for.

more

But e^5 equals -38*a*b*c*d*e in S, so the expression can be written as a polynomial in the mi times a*b*c*d*e

( 2014-12-17 07:55:42 -0500 )edit

Sorry, my answer didn't correctly reflect what I wanted to express. I edited it and hopefully it is clearer now.

( 2014-12-17 12:48:59 -0500 )edit

## Stats

Seen: 77 times

Last updated: Dec 17 '14