Manipulate coefficient extracted from symbolic derivation
Hi,
var('k')
f=function('f')(r)
for k in range(1,5):
h(r)=r^(2*k-1)
t=f*h
for i in range (1,k):
t=(r^(-1)*diff(t,r)).collect(r)
end
b=t.coefficient(r*f)
show(t)
show(factor(b))
end
Output (last line)
r ↦ r4D[0,0,0](f)(r)+18r3D[0,0](f)(r)+87r2D[0](f)(r)+105rf(r)|
105|
I would have want it in a factorized form (135*7).
It seems that coefficient() gives the result as a function, because if i look with show(b)
r ↦ 105|
What can I do better or is this just not possible with sage code?
Thanks
Ps. The notation of higher order derivatives of symbolic functions should be better than D[0,0,...,0]f(r). Hopefully someone fixes it.