Maxima vs Axiom



On 11/26/2011 09:50 PM, Stavros Macrakis wrote:
> You can do this with only trivial, superficial syntactic changes in Maxima:
>
> define( f(x) , x^2+x-2 )$
> define( df(x) , diff(f(x),x) )$
> define( nr(x), x-f(x)/df(x) )$
> ( t: nr(.7),
>    for i thru 10 do t:nr(t) )$
>
> This is not the way I'd recommend doing things, but you can certainly do it
> this way.
>
> If you prefer an infix syntax for definition, you can easily define it like
> this:
>
> infix("%:%",20,20)$
> (a %:% b) := define(ev(a),b);
>
> and then write:
>
> f(x) %:% x^2+x-2 $
> df(x) %:% diff(f(x),x) $
> nr(x) %:% x-f(x)/df(x) $
>
>
> Not sure what that gains you.
>
> But again, I DO NOT recommend working like this....


But if working this way is going to get me in trouble later, then maybe 
Maxima is not the program I should be using (though I'm struggling to 
find something better).

Can you explain to me what the "define" function does? Is there a 
shortcut for it?

The Maxima ":" is not too bad. The problem is that when I want to call 
the function it looks ugly:

f : x^5 + x^2 - 1;
df : diff( f,x );
nr : x - f/df;

nr,x=2.0;


If there was a way to write "nr(2.0)" to mean "nr,x=2.0" I would be 
happy. But as it is now, if I want to use functions in an expression and 
use the ":" syntax, I'd have to write things like:

foo = 2 * f,x=3 + g,x=h,x=2 / 3

And to me that looks horrible and error prone. You see what I mean?

Daniel.
-- 
I'm not overweight, I'm undertall.