On 12/26/05, Stavros Macrakis wrote:
> In Maxima, conditionals like "if (x<0) ..." are treated as imperatives
> which are always evaluated. So if x<0 is not known to Maxima, it is
> an error.
Well, not to beat a dead horse, but, I'm working on it.
I've made a lot of progress; it turns out it is fairly straightforward.
It won't be in 5.9.3 but I hope we can consider it for 5.9.4.
It is not too early to begin discussion what kinds of simplification
rules we would like to see for operations on conditionals.
About integrals, a rule like
'integrate (if A then f(x) else g(x), x) -> if A then 'integrate
(f(x), x) else 'integrate (g(x), x)
(when A is free of x) seems OK. The fun begins with stuff like
'integrate (if A(x) > 0 then f(x) else g(x), x)
where we get to argue about what restrictions to put on A(x).
But even simple inequalities (e.g. x > 1) will be useful.
A couple of random thoughts ---
I'm convinced the right way to represent simplification of
conditionals within diff, integrate, etc is to use the tellsimpafter
system. My experience has been that tellsimpafter is quite
powerful, and it is much easier to comprehend a rule
displayed as foo(x,y) -> bar(y,x) than as Lisp code.
Also we might consider unifying if, charfun, and abs
(maybe others) by choosing one and expressing the
others in terms of it. Otherwise we will need to create
simplification rules which are essentially duplicates.
For what it's worth,
Robert Dodier