Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to get Polynomial Coefficients

Hi

I would like to get the value of coeffs of x^5 + px^3 + qx^2 + rx + s something like [1,0, b - 2/5a^2,...] I do not understand what means the coefficients() outputs in the code below ??

forget()
import math
for v in var( 'a,b,c,d,e' ):    assume( v, 'rational' )
for v in var( 'p,q,r,s' ):    assume( v, 'rational' )
x = PolynomialRing(RationalField(), 'x').gen()
t = PolynomialRing(RationalField(), 't').gen()
Pt= t^5 + a*t^4 + b*t^3 + c*t^2 + d*t + e
vChgt=t==x-a/5
P=Pt.substitute(vChgt)
#Px= x^5          + p*x^3 + q*x^2 + r*x + s
show(P.factor())
show(P.factor().coefficients(sparse=False))
show(P.factor().list())
P.factor()