How to get diff to yield result in terms of original function
Subject: How to get diff to yield result in terms of original function
From: Stavros Macrakis
Date: Thu, 8 Jan 2004 16:09:25 -0500
PS
The gradef approach may also be useful for another reason. There is no
good representation for the derivative f' of an arbitrary function f in
Maxima. To represent f'(x), you must use:
at(diff(f(qqq),qqq),qqq=x)
Note the use of an obscure dummy variable name qqq to avoid substitution
problems.
For this reason, DIFF does not use the chain rule for undefined
functions:
diff(f(x^2),x) => 'diff(f(x^2),x)
though it could in principle have returned
2*x*'at(diff(f(qqq),qqq),qqq=x^2))
If you use gradef, on the other hand, you can explicitly define f1, f2,
etc. as the derivatives:
gradef(f(x),f1(x))
gradef(f1(x),f2(x))
and now
diff(f(x^2),x) => 2*x*f1(x^2)
diff(f(x^2),x,2) => 4*x^2*f2(x^2) + 2*f1(x^2)
diff(f(f(x)),x,2) => f1(x)^2*f2(f(x)) + f2(x)*f1(f(x))
Unfortunately, Maxima doesn't really know anything about f1, e.g.
integrate(f1(x),x) => noun
-s