Bug Report: Maxima hangs on definite integration and simplification

sexymaxima via Maxima-discuss <[email protected]> Sun, 14 Jun 2026 17:19:47 +0000
Newsgroups gmane.comp.mathematics.maxima.general
Message-ID <fAdHoQ73S1tnwGwCKJ6t3cYA7hDTCLN8DPLKx23sCqozi5hL9Mwz-Ue56jIofItU4U5heKfyZvTLpyjnTRnvoMMOnZ_h9WMEZG8MgxF1QJk=@proton.me>
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