# how to solve equations for polynomials coefficients?

I am new to SAGE so sorry if this question is trivial. I have this code

  R2.<a0,a1,a2,a3, a4,b0,b1,b2,b3, b4,z,w,l,E,E1,v,t> = PolynomialRing(ZZ,17)
R.<x> = PowerSeriesRing(R2)
p = a1*x -a1*z*x**2+ a3*x**3+a4*x**4 +O(x**12)
k = b1*x+b2*x**2+ b3*x**3+b4*x**4 +O(x**12)
p1 = p.derivative()
p2 = p1.derivative()
y =2/x*(z-v*x)-E
x=2/x*a1*w*x**2
g=x*(p2 +y*p-x-E1*k)
v1=g.coefficients()
solve(v1,a3)


I am getting this error a3 is not a valid variable.

My question is how to solve equations for polynomials coefficients?

edit retag close merge delete

1

solve is supposed to have (a listof) symbolic expressions (or symbolic expressions) as first argument, and (al list of) symbolic variables as second argument. in the call solve(v1, a3), both arguments are polynomials :

sage: v1.parent()
Multivariate Polynomial Ring in a0, a1, a2, a3, a4, b0, b1, b2, b3, b4, z, w, l, E, E1, v, t over Integer Ring
sage: a3.parent()
Multivariate Polynomial Ring in a0, a1, a2, a3, a4, b0, b1, b2, b3, b4, z, w, l, E, E1, v, t over Integer Ring


A possible workaround is :

sage: WA=SR(v1).solve(SR(a3)); WA
a3 == 1/3*a1*z^2 + 1/6*E*a1 + 1/6*E1*b1 + 1/3*a1*v + 1/3*a1*w


but note that

sage: WA.rhs().parent()
Symbolic Ring


I do not understand what

 x=2/x*a1*w*x**2


is supposed to mean...