| 1 | initial version |
Yes, you can do it like this:
sage: R.<x> = PolynomialRing(ZZ)
sage: p = 1+x+2*x^2+x^3+x^4
sage: K.<z> = CyclotomicField(5)
sage: p(z)
z^2
Here it's important that x is the generator of a polynomial ring.
It doesn't work when x is symbolic, as you noticed.
If you have to start with a symbolic polynomial, then you can convert it first using the polynomial() method:
sage: var('y')
sage: q = 1+y+2*y^2+y^3+y^4
sage: q.polynomial(ZZ)(z)
z^2
| 2 | No.2 Revision |
Yes, you can do it like this:
sage: R.<x> = PolynomialRing(ZZ)
sage: p = 1+x+2*x^2+x^3+x^4
sage: K.<z> K.<w> = CyclotomicField(5)
sage: p(z)
z^2
p(w)
w^2
Here it's important that x is the generator of a polynomial ring.
It doesn't work when x is symbolic, as you noticed.
If you have to start with a symbolic polynomial, then you can convert it first using the polynomial() method:
sage: var('y')
sage: q = 1+y+2*y^2+y^3+y^4
sage: q.polynomial(ZZ)(z)
q.polynomial(ZZ)(w)
z^2
| 3 | No.3 Revision |
Yes, you can do it like this:
sage: R.<x> = PolynomialRing(ZZ)
sage: p = 1+x+2*x^2+x^3+x^4
sage: K.<w> = CyclotomicField(5)
sage: p(w)
w^2
Here it's important that x is the generator of a polynomial ring.
ring. It doesn't work when x is symbolic, as you noticed.
If you have to start with a symbolic polynomial, then you can convert it first using the polynomial() method:
sage: var('y')
sage: q = 1+y+2*y^2+y^3+y^4
sage: q.polynomial(ZZ)(w)
z^2
| 4 | No.4 Revision |
Yes, you can do it like this:
sage: R.<x> = PolynomialRing(ZZ)
sage: p = 1+x+2*x^2+x^3+x^4
sage: K.<w> = CyclotomicField(5)
sage: p(w)
w^2
Here it's important that x is the generator of a polynomial ring. It doesn't work when x is symbolic, as you noticed.
noticed. If you have to start with a symbolic polynomial, then you can convert it first using the polynomial() method:
sage: var('y')
sage: q = 1+y+2*y^2+y^3+y^4
sage: q.polynomial(ZZ)(w)
z^2
| 5 | No.5 Revision |
Yes, you can do it like this:
sage: R.<x> = PolynomialRing(ZZ)
sage: p = 1+x+2*x^2+x^3+x^4
sage: K.<w> = CyclotomicField(5)
sage: p(w)
w^2
Here it's important that x is the generator of a polynomial ring. It doesn't work when x is symbolic, as you noticed. If you have to start with a symbolic polynomial, then you can convert it first using the polynomial() method:
sage: var('y')
sage: q = 1+y+2*y^2+y^3+y^4
sage: q.polynomial(ZZ)(w)
z^2
w^2
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.