Intelligent result checking before asking positive/negative/zero...?



Stavros Macrakis wrote:

>>>Is there anyway to tell Maxima to try all possibilities and give all
>>>answers rather than asking questions such as "is x positive negative or
>>>zero?"?
> 
> 
> There is no such functionality today.
> 
> In principle, it could be built rather straightforwardly.  You would
> intercept all user questions, record them, and give one of the
> answers.  Then, when the calculation was finished, you would repeat it
> with each different combination of answers (and possibly new ones). 
> You would then combine the answers.

If I understand the proposal, I think this would not be a good approach.
   I would prefer
that the conditions of validity be carried through the computation
in the "forward" direction.  This requires rewriting a lot of programs, though.

If you end up with something like  answer =   (if x<0 then A else if x>=0 then A)  you
have to simplify it to  answer=A.

The table entries in TILU have to be combined, sometimes, and TILU
doesn't do it.

e.g.  if x=2 then f(2) else f(x).

> 
> To make this useful, you'd want to analyze the questions
> intelligently, and combine the results intelligently.  You'd also want
> to handle errors reasonably.  The result would be represented as some
> sort of conditional expression, e.g.
> 
>       integrate(x^a,x,0,1) => 'if a>-1 then 1/(a+1) else 'und

I'm not sure that "if"  is the right thing to use.
If a>=0 .....   may not be the same as  a context in which assume(a>=0).
> 
> If you work through this example, you realize that things are rather
> messy.  Maxima has bugs in integral assumption handling (documented in
> the bug list) where assumptions persist after an error.  There are
> lots too many questions.  And of course Maxima doesn't actually
> support conditional expressions in any useful way.
yes.
> 
> But it could be a fun project to clean all this up and make it work.
There was an MS project by Sam Dooley, trying to make the maxima simplifier
keep track of assumptions.

> 
>         -s