:

## Bug in integrals of absolute value

Maple 15

A common example to emphasize that it is not OK to bring absolute values inside the integral compares

`abs( int( cos(n*x), x=0..Pi ) ) asuming n::integer`

and

`int( abs( cos(n*x) ), x=0..Pi ) assuming n::integer`

Maple correctly formulates the first to 0. But the second expression gives it more trouble, returning two messages:

`Warning, unable to determine if (1/2)*Pi*(1+2*_Z7)/n is between 0 and Pi; try to use assumptions or use the AllSolutions optionWarning, unable to determine if (1/2)*Pi*(1+2*_Z8)/n is between 0 and Pi; try to use assumptions or use the AllSolutions option`

For these to be true, the integers _Z7 and _Z8 would need to be strictly less than n (but I'm guessing that Maple thinks they can also be equal to n).

That Maple is not able to handle the general case is not completely unreasonable.

What is unacceptable is that Maple cannot handle specific cases when n>=12.

`seq( int( f(n,x), x=0..Pi ), n=1..24 );                                 11  24  13  28  15  32  17  36  19  40  21  44  23`
`2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, --, --, --, --, --, --, --, --, --, --, --, --, --`
`                                  6   13  7   15  8   17  9  19  10  21  11  23  12`

The error suggests to me that Maple is correctly identifying the different intervals that need to be considered, but that it is having trouble with the last one. There appears to be a difference with even and odd values of n. It's as though there are two bad intervals when n is odd and only one bad interval when n is even.

It's really surprising to me that Maple has this problem. It's even more surprising that this has not been discovered before now. (Of course, maybe it is a new problem that did not exist in some or all earlier versions.)

I have reported this as a bug to Maplesoft, but wanted to see the ideas and response from the MaplePrimes community as well.

Doug

```---------------------------------------------------------------------