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.
-s
On Sun, Nov 27, 2011 at 18:30, Daniel Carrera <dcarrera at gmail.com> wrote:
> On 11/27/2011 11:50 PM, Michel Talon wrote:
>
>> ... This being said, i have checked that the "function" concept in
>>
>> maxima and in maple work exactly the same, so one can safely say this is
>> the
>> standard way of doing things...
>>
>
> I'm not sure about that. You can do this in Maple:
>
> |\^/| Maple 15 (IBM INTEL LINUX)
> ._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc.
> 2011
>
> \ MAPLE / All rights reserved. Maple is a trademark of
> <____ ____> Waterloo Maple Inc.
> | Type ? for help.
> > f := x -> x^2;
> 2
> f := x -> x
> > df := x -> D(f)(x);
> df := x -> D(f)(x)
> > df(x);
> 2 x
> > df(3);
> 6
>
>
> You can implement the rest of Newton's method without any funky syntax:
>
> > nr := x -> x - f(x)/df(x):
> > nr(2.0);
> 1.000000000
> > nr(%);
> 0.5000000000
> > nr(%);
> 0.2500000000
> > nr(%);
> 0.1250000000
>
>
> I think Maple has the best syntax I've seen so far, but I don't want to
> depend on a proprietary product.
>
>
> Cheers,
> Daniel.
> --
> I'm not overweight, I'm undertall.
> ______________________________**_________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>
>