Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

variable size exponent for Polynomial Ring

Is it possible to use a positive variable size exponent in a expression from elements in a polynomial ring? I have the following expression:

P.<x> = PolynomialRing(ZZ)
R = P.quotient_by_principal_ideal(ideal(x^3 - 3))
expr = R(x)

and I want to calculate expr^k where k is some positive integer. What I have is the following:

k = var('k', domain='positive')
expr^k

But I get the error: unsupported operand parent(s) for ^: 'Univariate Quotient Polynomial Ring in xbar over Integer Ring with modulus x^3 - 3' and 'Symbolic Ring'

I'm very new to sage so any help or pointers to the documentation would be appreciated