Maxima vs Axiom



> If there was a way to write "nr(2.0)" to mean "nr,x=2.0" I would be happy.

The syntax "nr,x=2.0" is another feature (the "ev" function) that I would
discourage you from using.  The simple cases work fine, but they don't
generalize nicely when you start programming.

> 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).

That's one way of looking at it.  Another way is to realize that every tool
has idiosyncracies and you may want to learn to use the tool effectively,
which means that you don't necessarily do things in ways that come
naturally to you at first.

I'm not saying that all these idiosyncracies are intellectually defensible,
just that that is what they are for now.  But many idiosyncracies respond
to concerns that you may not be aware of or interested in.  For example,
you seem to want to use Maxima as a desk calculator.  But many users of
Maxima like to use it as programming language, where the functions they
define are not functions mapping numbers to numbers (as in your examples),
but functions over *expressions* (mapping expressions to expressions or
mapping expressions to numbers).

And remember, "le mieux est l'ennemi du bien".

            -s

On Sat, Nov 26, 2011 at 16:25, Daniel Carrera <dcarrera at gmail.com> wrote:

> 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.
>