# [Maxima] How to assign a derivative of a function to a new function?

Richard Fateman fateman at cs.berkeley.edu
Fri May 9 09:42:42 CDT 2008

```try  dy(x):=''diff(y,x).
You want to evaluate that diff  when you define the function, not when you
call it (because then x=0).

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Philippe Boeraeve
> Sent: Friday, May 09, 2008 3:02 AM
> To: maxima at math.utexas.edu
> Subject: [Maxima] How to assign a derivative of a function to
> a new function?
>
> Hello,
>
> 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.
> In the example below, I first assign a third degree
> polynomial to y(x).
> Then I assign the derivative of that function to another
> function (dy(x)).
> When I check, dy(x) shows well the derivative of the function y(x).
> When I want to know the value of dy(x) in x=0, I get an error message.
>
> Does anyone have a solution to my problem?
>
> Thanks
>
> Philippe
>
>
> (%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);
> Non-variable 2nd argument to diff:
> 0
> #0: dy(x=0)
>  -- an error.  To debug this try debugmode(true);
>
```