Stochastix wrote:
I have the following problem : I have two nested functions
a=lambda x: 2*x
b=lambda x: a(x)^2
Everything goes well as long as I want to compute the derivative of b
but how can I evaluate this derivative at x=2.
I tried
g=lambda x: diff(b(x),x)
g(x) returns 8*x as expected
but g(2)=0.
What is happening is that since g is a lambda function, g(something) is
literally returning the result of diff(b(something), something). So
g(x) is returning the result of the command diff(b(x),x), and g(2) is
returning the result of diff(b(2),2).
The key is not using lambda in this case. Other posts have shown how to
do what you want.
Thanks,
Jason
--
Jason Grout
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org