C. Kelly wrote :
I define the following one-parameter functions and their derivatives
x,y,l,L = var('x,y,l,L')
d5 = function('d5',nargs=1)
def d3partderiv(self,*args,**kwds): arg = args[0]; return
L*L*d5(arg);
d3 = function('d3',derivative_func=d3partderiv)
def d1partderiv(self,*args,**kwds): arg = args[0]; return -( d3(arg)
+d1(arg) )/arg
d1 = function('d1',derivative_func=d1partderiv)
The derivatives work correctly:
diff(d1(x^2),x) ---> -2*(d3(x^2) + d1(x^2))/x
diff(d3(x^2),x) ---> 2*L^2*x*d5(x^2)
but the Taylor expansion of d1(x) to second order gives
taylor( d1(x), x, 0, 2) ---> 1/2*x^2*D[0, 0](d1)(0) + x*D[0](d1)(0)
+ d1(0)
I don't understand what do you expect.
diff(f(x^2), x) == 2*x*D(f)(x^2) # it's what I get
diff(f(x^2),x,x) == 4*x^2*D^2(f)(x^2) + 2*D(f)(x^2) # it's also what I get
D[0,0](fct)(a^2) means diff twice from variable 0 (the only one variable).
I test
sage: var('a x') ; function ('fct') ;
sage: T1 = diff (fct(x^2), x, x)(x=a)*(x-a)^2/2 + diff (fct(x^2),
x)(x=a)*(x-a) + fct(a^2) ; T1
sage: T2 = taylor (fct(x^2), x, a, 2)
sage: T1-T2 # and I get 0
But I recognize I don't understand exactly where you see an error.
Feel free to ask again.
F. in France.
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org