Asksign quick and dirty



Here is a "modest proposal" for the asksign problem.  The goal here is not
to solve it in a nice, clean, general way, but rather to allow other
programs to use Maxima in a single-request/single-reply mode.

What if every time Maxima wanted to ask a question (in asksign, ask-evod,
ask-integer, etc.), we declare that the global result to the original
request is an object defining what additional information is needed.  If the
client is smart, it can then assert that information and try again (at the
cost of repeating parts of the calculation of course).

Example:

asksign_mode: 'return$

integrate(x^a,x,1/k,k);
   => that_depends(sign(a))$
assume(a<0)$
integrate(x^a,x,1/k,k);
  => that_depends(equal(a+1,0))
assume(a+1#0)$
integrate(x^a,x,1/k,0);
 => that_depends(sign((k-1)*k*(k+1)))
etc.

This would be implemented by throw'ing from the ask functions back to the
top level.

I know it's a bit hokey, but a) it preserves the request/reply system b)
it's not so bad for machine use (terrible for human use, of course).

Another possibility would be to always take one of the answers, and report
on which one, e.g.

asksign_mode: 'assume$

integrate(x^a,x,1/k,k) =>
      assuming( a>0 and (k-1)*k*(k+1) > 0, k^(a+1)/(a+1)-k^(-a-1)/(a+1) )

Of course, the assumptions may be ridiculous, but at least they're
documented.

           -s