Re: Bug Report: Maxima hangs on definite integration and simplification
Stavros Macrakis <[email protected]> Sun, 14 Jun 2026 16:45:50 -0400
| Newsgroups | gmane.comp.mathematics.maxima.general |
|---|---|
| Message-ID | <CACLVabX9QNQZYEZGCzzp-_N7jhZXxTUTxt0SOO1kT1DNr6O1sA@mail.gmail.com> |
Your message wasn't delivered to *[email protected]* because the address couldn't be found, or is unable to receive mail. Troll? On Sun, Jun 14, 2026 at 4:44 PM Stavros Macrakis <[email protected]> wrote: > These are interesting examples, although I'm not sure how important they > are in practice. I think practical problems tend to be messier.... > > If your goal is to solve these as practical problems, there are several > useful approaches: > > - Try *scanmap(trigsimp,...,bottomup)* -- that will simplify from the > "bottom up". > - For problems including *EX^10000*, try solving them with *EX^a* and > then substituting back in. > > If your goal is to show that Maxima doesn't use the optimal strategy in > all cases, that's certainly true. In many math problems, there are multiple > possible tricks (a.k.a. heuristics) that might be useful, and they can be > tried in different orders. One way to try multiple heuristics is to try > more than one, but limit the "effort" on each (time, size of intermediate > results, aches, each time-limited, e.g., try expanding, try trig > simplifications bottom-up, try factoring, etc. That's a tactic that Maxima > never uses, as far as I know. > > It does seem obvious in this case that *trigsimp* should be applied > bottom-up before trying anything else, but in other cases, some other > approach might be better. > > > On Sun, Jun 14, 2026 at 2:38 PM sexymaxima via Maxima-discuss < > [email protected]> wrote: > >> Description >> >> Maxima correctly handles the symbolic simplification and indefinite >> integration of the expression (sin(x)^2 + cos(x)^2)^1000000, but fails >> (hangs indefinitely) when a definite integral is requested or when the >> exponent is a large concrete integer in certain contexts. >> **Bug Report: Maxima hangs on definite integration and simplification of >> `(sin(x)^2 + cos(x)^2)^N` for large integer N** >> >> *Steps to Reproduce* >> >> 1. Indefinite integral works: >> ```maxima >> integrate((sin(x)^2 + cos(x)^2)^1000000, x); >> ``` >> → Returns `x` (correct, since `sin(x)^2 + cos(x)^2 = 1`). >> >> 2. Definite integral hangs: >> ```maxima >> integrate((sin(x)^2 + cos(x)^2)^1000000, x, 0, %pi); >> ``` >> → Maxima becomes unresponsive / hangs. >> >> 3. Symbolic exponent works with `trigsimp`: >> ```maxima >> trigsimp((sin(x)^2 + cos(x)^2)^a); >> ``` >> → Correctly returns `1`. >> >> 4. Integer exponent fails with `trigsimp`: >> ```maxima >> trigsimp((sin(x)^2 + cos(x)^2)^1000000); >> ``` >> → Maxima hangs or fails to simplify. >> >> *Expected Behavior* >> Maxima should recognize that `sin(x)^2 + cos(x)^2 = 1` (via trigonometric >> simplification rules) and immediately return: >> - `x` for the indefinite integral, >> - `%pi` for the definite integral from 0 to `%pi`, >> - `1` for `trigsimp` regardless of whether the exponent is symbolic or a >> large integer. >> >> *Actual Behavior* >> - Works only for indefinite integration with the large integer power. >> - Hangs on definite integration and on `trigsimp` when the exponent is a >> concrete large integer. >> >> *Additional Notes* >> This appears to be a performance/scaling issue in the trigonometric >> simplification or integration routines when dealing with very large integer >> exponents. Maxima should apply the basic identity `sin^2 + cos^2 = 1` >> early, before expanding the huge power. >> >> _______________________________________________ >> Maxima-discuss mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/maxima-discuss >> > _______________________________________________ Maxima-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/maxima-discuss