evaluations of derivative functions




-----maxima-bounces at math.utexas.edu wrote: -----

>To: maxima at math.utexas.edu
>From: sen1 at math.msu.edu
>Sent by: maxima-bounces at math.utexas.edu
>Date: 03/21/2007 05:48AM
>Subject: evaluations of derivative functions
>

>For instance, consider the following lines.
>
>(%i1) f(x):= x^2;
>                                            2
>(%o1)                             f(x) := x
>(%i2) g(x):= diff(f(x),x);
>(%o2)                        g(x) := diff(f(x), x)
>(%i3) g(2);

>Why is it necessary to put in the 'subst' command?  Is there a better
>way to do this?

Yes, there is a better way. When you define your function f, you need
to tell Maxima to evaluate the function body. To do this, use two
single quotes:

(%i1) f(x):= x^2$
(%i2) g(x):= ''(diff(f(x),x))$
(%i3) g(2);
(%o3) 4

Notice: You need ''(diff(f(x),x)) *not* ''diff(f(x),x).

Barton