How can I assign a derivative result to a function?



>>>>> Marcos Paulo Serafim <mpserafim at gmail.com> (MPS) wrote:

>MPS> Hello,
>MPS> I'm a beginner user of Maxima and I'm trying to do something like:

>MPS> f(x):=x^3;
>MPS> g(x):=diff(f(x));

>MPS> But when I try to get the value of g(x) (g(3), for example) Maxima only
>MPS> show me 0.

>MPS> How would be the correct syntax of this assignment?

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

or 

define (g(x), diff (f(x), x));

Reason: g(x):= does not evaluate the righthandside, so in essence g(3) is
differentiating f(3) (I think) which is a constant.
[Ack: I got this from an old message by Robert Dodier]
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org