How can I assign a derivative result to a function?
Subject: How can I assign a derivative result to a function?
From: Jaime E. Villate
Date: Mon, 20 Mar 2006 09:11:56 +0000
On Sun, 2006-03-19 at 10:17 -0300, Marcos Paulo Serafim wrote:
> I'm a beginner user of Maxima and I'm trying to do something like:
>
> f(x):=x^3;
> g(x):=diff(f(x));
>
> But when I try to get the value of g(x) (g(3), for example) Maxima only
> show me 0.
Hi,
"f(x):=" does not really define a mathematical function, but a small
program f, with an input x, and a set commands.
To deal with mathematical functions, a much better way is as follows:
Defining function x:
f: x^3;
computing f(3):
f, x=3;
defining the derivative of f:
g: diff(f,x)
(do not leave ",x" out, even if it is clear that the function only
depends on x)
computing g(3):
g, x=3;
defining the composed function f(f(x)):
f2: f, x=f;
plotting function f2:
plot2d(f2, [x,-2,2])$
I hope this helps.
Jaime