Decompose polynomial by other irreducible polynomial
Suppose I have irreducible polynomial v(x) over Q (or arbitrary field). I want to decompose any other f(x)∈Q[x] by powers of v. Like this f(x)=an(x)(v(x))n+⋯+a1(x)v(x)+a0(x)
Is there some fast(?) way to do it in Sage except by hand writing your own function?
UPD. I forget to add that degai<degv.
UPD2. Naive solution:
degree = f.degree()//v.degree()
decomposition = [None] * (degree + 1)
for i in range(degree+1):
decomposition[i] = f%v
f //= v
return decomposition
But may be there is some native solution