7.84 Bug in integration 4, Maple V to Maple 7 (20.7.00)

7.84.1 Joao C A Barata
7.84.2 Robert Israel (21.7.00)
7.84.3 Helmut Kahovec (24.7.00)

7.84.1 Joao C A Barata

I believe I have found a bug in Maple’s integration package (I use Maple V.5).

Computing

> int( 1/((A - cos(p + K))*(A - cos(p - K))), p=-Pi..Pi );
 

Maple returns zero, what is certainly wrong. Even being more specific about the parameters A, B and K produces errors. For example

> assume(A > 1); 
> assume(B > 1); 
> assume(K, real); 
 
> int(1/((A - cos(p + K))*(A - cos(p - K))), p=-Pi..Pi);
 

also returns zero. Note that for A > 1 and B > 1 the integrand is positive and, hence, the integral cannot be zero.

If you specify numerical values for A, B and K, as below

> evalf(int(1/((2 - cos(p + 3))*(2 - cos(p - 3))), p=-Pi..Pi));
 

Maple returns the correct (non zero) value, something like \(2.40245\) .

I would like to know if there is a way to avoid error like this. The integrals I need to compute are actually more complicated than this one, but also involve integrals of ratios of trigonometrical polynomials.

7.84.2 Robert Israel (21.7.00)

This is basically a branch cut problem. Unfortunately, this sort of thing is not unexpected. Maple does this integral by first computing an antiderivative, a rather complicated expression involving logarithms and arctans, and then uses the Fundamental Theorem of Calculus. It tries to identify discontinuities of the antiderivative, but apparently is unsuccessful (depending on the values of the parameters). Maple 6 may be trying harder, but seems to run into a bug:

Error, (in limit) invalid limiting point

I get the same error message with Maple 7. Including the assumptions I get a piecewise solution. Maple 8 produces a piecewise solution in both cases. (U. Klein)

Including the assumptions I get a set of solutions with Maple 6. (U. Klein)

7.84.3 Helmut Kahovec (24.7.00)

The current version of Maple, maple6, seems to get caught in an endless loop while computing your definite integral:

> restart; 
> j:=1/((A-cos(p+K))*(A-cos(p-K))); 
 
                                     1 
                j := --------------------------------- 
                     (A - cos(p + K)) (A - cos(p - K)) 
 
> int(j,p=-Pi..Pi); 
Warning, computation interrupted
 

Note, however, that evalf(int(...)); means that Maple tries to compute the definite integral symbolically before calculating a numerical approximation:

> int(1/((2 - cos(p + 3))*(2 - cos(p - 3))), p=-Pi..Pi); 
 
                                      2                 2 
  - 4/3 (4 sqrt(3) Pi - 3 %2 %4 cos(6)  - 3 %2 %4 sin(6) 
 
                  ... lines skipped ... 
 
                   2         2 
  %1 := -4 + cos(6)  + sin(6) 
 
                       2         2 
  %2 := sqrt(4 - cos(6)  - sin(6) ) 
 
               %2 (2 cot(3/2) + cot(3/2) cos(6) + sin(6)) 
  %3 := arctan(------------------------------------------) 
                                   %1 
 
               %2 (-2 cot(3/2) - cot(3/2) cos(6) - sin(6)) 
  %4 := arctan(-------------------------------------------) 
                                   %1 
 
> evalf(%); 
 
                             2.402450983
 

If you want to avoid any symbolic integration you should use evalf(Int(...)); .