ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 03 May 2016 06:48:44 -0500Manipulate coefficient extracted from symbolic derivationhttps://ask.sagemath.org/question/33304/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 (1*3*5*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.
MathBoyTue, 03 May 2016 06:48:44 -0500https://ask.sagemath.org/question/33304/