How to assign a derivative of a function to a new function?



2008/5/9 Philippe Boeraeve <p.boeraeve at hemes.be>:
> I am trying to assign a derivative to a new function, in order to know the
> value of the derivative of the function at one point.
> (%i1) y(x):=a*x^3+b*x^2+c*x+d;
> (%o1) y(x):=a*x^3+b*x^2+c*x+d
> (%i2) dy(x):=diff(y(x),x);
> (%o2) dy(x):=diff(y(x),x)
> (%i3) dy(x);
> (%o3) 3*a*x^2+2*b*x+c
> (%i4) dy(0);

dy(x):= ''( diff(y(x),x) )$

Two singlequotes substitute the following expression <<at the time it
is read in>>.

An alternative way, perhaps more in the style of Maxima, would be to
work with expressions:

y: a*x^3+b*x^2+c*x+d$
dy: diff(y,x)$

then

subst(0,x,dy)
or
ev(dy,x=0)

Let us know if you have other issues.

            -s