# [Maxima] Definite integrals and asksign

Stavros Macrakis macrakis
Fri Dec 8 15:19:51 CST 2006

```>     Neilen> Would I be correct in guessing that Maxima would have been able to figure out
>     Neilen> what you passed in the assume() above if it had a built in multiple integral
>     Neilen> routine that could consider all the integral limits simultaneously?

Yes, you could easily write a multiple-integral routine to handle this
(it doesn't have to be built-in).

The more general problem is that the ordinary evaluator isn't really
well-suited to this kind of problem, since it always proceeds
inside-out: to evaluate f(g(x)), you first evaluate g(x) => temp and
only then f(temp), and 'f' has no opportunity to tell g about the
context within which it is operating. A special multiple-integral
routine could take care of this, but wouldn't handle an integral
nested inside a limit, a sum nested inside an integral, etc.

It is possible to work around these problems by having each of these
routines do its own special evaluation tricks (using fexprs), but it
would be better if we could devise a uniform scheme for mathematically
bound variables, something like this:

integrate( inner(expr), boundvar(var, assume(var >= lower, var <=
upper)), lower, upper) := ...

limit(inner(expr), boundvar(var,
if direction = plus then assume(var > point)
elseif direction = minus then assume(var<point)
else assume(var#point),
if point=inf then assume(var>10^10)   /* crude */
etc..........  ),
point,
direction ) := ...

The notion is that the evaluator would do whatever is necessary to
create a new evaluation context within which the various assumptions
would hold, and that would be the evaluation context for expr.

This syntax isn't great (for one thing it doesn't handle interactions
among bound variables), but the idea is that the Maxima system (the
evaluator) would handle these issues in some uniform way.  Also, it is
more important to get this right for Maxima internals than for the
user-visible Maxima language.

I haven't thought all this through very carefully, but of course it
will have all the same issues that we discussed in the 'sum' case.

> ...it would be fairly difficult for maxima to figure out that 1 - x1 - x2 > 0.

Yes, Maxima isn't currently very smart about understanding the
consequences of sets of inequalities.

-s

```