evaluations of derivative functions



Maybe what you want to do is

G(x):=''diff(f(x),x);

That way g(x) will be defined as 2*x.

 

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu 
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of sen1 at math.msu.edu
> Sent: Wednesday, March 21, 2007 3:48 AM
> To: maxima at math.utexas.edu
> Subject: evaluations of derivative functions
> 
> Hello,
>   I have a question about how maxima handles function definitions and
>   derivatives.  I am mainly interested in plotting functions 
> associated
>   with other 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);
> 
> Non-variable 2nd argument to diff:
> 2
> #0: g(x=2)
>   -- an error.  To debug this try debugmode(true);
> (%i4) g(t):= subst(x=t,diff(f(x),x));
> (%o4)                 g(t) := subst(x = t, diff(f(x), x))
> (%i5) g(t);
> (%o5)                                 2 t
> (%i6) g(x);
> (%o6)                                 2 x
> (%i7) g(2);
> (%o7)                                  4
> 
> 
> Why is it necessary to put in the 'subst' command?  Is there a better
> way to do this?
> 
> TIA,
>   -sen
> 
> 
> 
>   
> --------------------------------------------------------------
> -------------
>   | Sheldon E. Newhouse            |    e-mail: 
> sen1 at math.msu.edu           |
>   | Mathematics Department         |       			
> 	   |
>   | Michigan State University      | telephone: 517-355-9684  
>               |
>   | E. Lansing, MI 48824-1027 USA  |       FAX: 517-432-1562  
>               |
>   
> --------------------------------------------------------------
> -------------
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>