On 10/19/06, Marco Ciampa <ciampix at libero.it> wrote:
> To extend the concept Maxima could be made avare to treat some
> "base tipes" numbers like integer, natural, rational, real or complex
> (and it could be made extensible too). Such a "typized" CAS would
> resolve automatically the problem of having to plot the result of an
> equation like this:
>
> plot2d([sqrt(x-2) * sqrt(x-4)], [x,-5,5]);
>
> only in the _real_ field.
I don't think that such an approach is workable in Maxima,
not even if we consider wishful thinking. However some aspect of
it is feasible, I believe.
In general the proposal is infeasible because in many places
Maxima constructs results without actually doing arithmetic.
So, for example, if the sqrt function refused to return imaginary
numbers, it might not help, because some other function can
still do return '((foo) 1 2 3 %i) whenever it wants.
The part that is feasible, I believe, is to rework the simplifier
to be more explicit about the identities it applies. The primary
goal here is to make the simplifier comprehensible.
At present there is no description or specification of the
identiies known to Maxima aside from the source code.
That's only useful to extremely dedicated, expert Lisp programmers.
I believe our audience is somewhat wider than that.
Anyway, a side effect of clearing up the simplifier would be
(I'm guessing) to make it easier to apply or retract groups
of identities. So it may well be possible to retract identities
which yield results in C, so that the simplifier (if not other
parts of Maxima) might yield only results in R. However in
the absence of any actual implementation, that's all speculation.
Finally I'll mention again that the plot_realpart
flag has the desired effect on plot2d.
For what it's worth,
Robert Dodier