Re: Bug Report: Maxima hangs on definite integration and simplification
Richard Fateman <[email protected]> Sun, 14 Jun 2026 11:53:11 -0700
| Newsgroups | gmane.comp.mathematics.maxima.general |
|---|---|
| Message-ID | <CADB8Zm7Zu02yz282rGvw3j3duz7ietkeX+=tpmQyuOO3bUb5Fg@mail.gmail.com> |
maybe the user should apply trigsimp before raising to a huge power? At least if it matters to get the answer to such questions. There are a large number of possible simplification routines which can be applied in some order or other, or not applied at all. Some heuristics (like expanding powers) can run into trouble. Apparently this happens with trigsimp in your example. It would be possible to construct a heuristic search simplification (or other task) framework where a strategy is pursued until it uses too much of some resource (time, memory), and another strategy might be pursued, etc. This was used in James Slagle's symbolic integration program (c. 1961) SAINT. Other heuristics (like don't expand powers above uh, 6) could be tried, but most likely they could still fail on some deviously constructed examples, leading to difficult-to-explain bugs. You may be able to design and then use the tools available to implement some heuristic super clever simplifier or integrator or ... Good luck On Sun, Jun 14, 2026 at 11:38 AM 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