-----maxima-admin@math.utexas.edu wrote: -----
>To: maxima@math.utexas.edu
>From: Jorge Barros de Abreu
>
>Sent by: maxima-admin@math.utexas.edu
>Date: 04/17/2005 03:31PM
>Subject: g(x):=diff(f(x), x);g(1);
>What the correct form to make it:
>
>f(x):=x^2;
>g(x):=diff(f(x), x);
>g(1);
I know two ways to do this. The first method uses 'define'
(%i1) f(x) := x^2;
(%o1) f(x):=x^2
(%i2) define(g(x),diff(f(x),x));
(%o2) g(x):=2*x
(%i3) g(1);
(%o3) 2
The second method uses ''
(%i7) diff(f(x),x);
(%o7) 2*x
(%i8) ggg(x) := ''%;
(%o8) ggg(x):=2*x
(%i9) ggg(1);
(%o9) 2
(%i10)
Here is something that does not work -- Maxima first
substitutes the argument of gg and then it does (or tries)
to evaluate the derivative.
(%i4) gg(x) := ''diff(f(x),x);
(%o4) gg(x):=DIFF(f(x),x)
(%i5) gg(z);
(%o5) 2*z
(%i6) gg(1);
Non-variable 2nd argument to DIFF:
1
#0: gg(x=1)
-- an error. Quitting. To debug this try DEBUGMODE(TRUE);
Regards,
Barton