On 11/28/2011 01:11 AM, Stavros Macrakis wrote:
> If that's all you want, the following (ugly but serviceable) definition of
> D will do it...
>
> D(f):=block([g:gensym()],funmake('lambda,[[g],diff(apply(f,[g]),g)]))
>
> f(x) := x^3$
> df(x) := D(f)(x)$
>
> f(2) => 8
> df(2) => 12
>
> I don't know how Maple does things, but in the case of Maxima, this
> calculates the derivative every time the df function is applied to a
> number, which is correct but very inefficient.
I just checked. Maple calculates the derivative eery time. So, for
example, if you change the definition of 'f', then 'df' would be
affected correspondingly.
--
I'm not overweight, I'm undertall.