Non-variable 2nd argument to DIFF:



If anyone needs yet another way ...

(%i1) load("c:/maxima/fdiff.lisp")$
(%i2) f(x) := x^3$
(%i3) df : fdiff(f,1)$
(%i4) [df(a), df(a+b), df(4), df(3.14)];
(%o4) [3*a^2,3*(b+a)^2,48,29.578800000000001]
(%i5) ddf : fdiff(f,2);
(%o5) LAMBDA([X],6*X)
(%i6) ddf(-6);
(%o6) -36

(defun $fdiff (f n)
 (if (and (symbolp f) ($member '$function (mfuncall '$properties f))
 (integerp n) (> n -1))
     `((lambda) ((mlist) $x) ,($diff (mfuncall f '$x) '$x n))
   (merror "Bogus input to fdiff")))


Barton



-----maxima-admin@math.utexas.edu wrote: -----

>To: maxima@math.utexas.edu
>From: Angus Leeming 
>Sent by: maxima-admin@math.utexas.edu
>Date: 05/12/2005 03:52AM
>Subject: Re: [Maxima] Non-variable 2nd argument
>to DIFF:
>
>On Wednesday 11 May 2005 23:57, Viktor T. Toth
>wrote:
>Viktor> > Can I call func so that it performs the
>analytic differentiation
>Viktor> > and then substitute for values of x?
>Viktor>
>Viktor> Here's one way of doing this:
>[snip details]
>Viktor> And here's another way:
>[snip details]
>
>On Wednesday 11 May 2005 19:44, Robert Dodier
>wrote:
>Robert> about '' (two single quote marks) -- it
>causes a reevaluation
>Robert> of the thing it is applied to. one single
>quote ' causes
>Robert> quotation and defeats evaluation; two
>single quotes '' defeats
>Robert> quotation and causes evaluation.
>
>Gentlemen, many thanks to you both.
>Angus
>
>_______________________________________________
>Maxima mailing list
>Maxima@www.math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxim
>a