Christopher Sangwin <c.j.sangwin at bham.ac.uk> writes:
> Richard,
>
> Yes, we have talked about this, and despite my best efforts I still
> struggle to understand when something is "evaluated" and when
> something else is "simplified" in Maxima.
>
> (%i1) simp:false$
> (%i2) gcd(x,y);
> (%o2) 1
>
> (%i3) 1+1;
> (%o3) 1+1
>
> Of course everything has to be evaluated! It just isn't clear to me
> when the simplifier is used and when it isn't. I know the view "if
One way to think of it is as a (very important!) implementation detail.
In Maxima, something like "gcd(x,y)" is represented as applying the
operator GCD to two arguments, X and Y. Similarly, "x+y" is applying the
operator + to the two arguments X and Y. Now, there are three things
that can happen
(1) Maybe there's a function called gcd.
In which case, it will be run with the given arguments and its
result will replace what you started with. This is what's happening
here.
(2) If no change, maybe there's a rule for how to simplify gcd(x,y)
An example is something like sin(x^2)+cos(x^2). The toplevel
operator of the expression is "+", and spotting that this is 1 isn't
really to do with "+" per se. Rules that spot this sort of thing are
called simplification rules. Classes of these rules can be turned on
and off using variables like trigsign, algebraic and many many
others.
More dramatically, you can turn them all off with simp: false.
(3) Finally, if Maxima has no idea what to do with an expression, it
just returns it, in the hope that some day in the future you can
tell it something else helpful.
I hope this makes the simplification/function distinction make a bit
more sense. I've ignored some details like simplification of arguments
and simplifying the result of simplifications and and and, but what I've
wrote is sort of true.
Rupert
PS. Before anyone points it out, yes I do know about the lisp/Maxima
$naming scheme. But that's irrelevant to the question above.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120126/52b32914/attachment.pgp>