7.59 bug in elliptic integrals in Maple V.5 (23.7.98)

7.59.1 Robert Michael Sinclair
7.59.2 Heike Koch-Beuttenmueller (24.7.98)
7.59.3 Herb Brown (24.7.98)

7.59.1 Robert Michael Sinclair

In preparing a demonstration of the Arithmetic Geometric Mean for students, I came across the following behaviour, in which the second symbolic integral (or its numerical evaluation) are wrong. All numerical values should have been the same:

    |\^/|     Maple V Release 5 (WMI Campus Wide License) 
._|\|   |/|_. Copyright (c) 1981-1997 by Waterloo Maple Inc. All rights 
 \  MAPLE  /  reserved. Maple and Maple V are registered trademarks of 
 <____ ____>  Waterloo Maple Inc. 
      |       Type ? for help. 
 
> f:=(a,b,theta)->1/sqrt(a^2*cos(theta)^2+b^2*sin(theta)^2); 
 
                                             1 
     f := (a, b, theta) -> ------------------------------------- 
                                 2           2    2           2 
                           sqrt(a  cos(theta)  + b  sin(theta) ) 
 
> int(f(1,1/2,theta),theta=0..Pi/2); 
 
                        EllipticK(1/2 sqrt(3)) 
 
> evalf(%); 
                             2.156515648 
 
> int(f(3/4,1/sqrt(2),theta),theta=0..Pi/2);        # This is the problem 
 
  8/3 sqrt(3) EllipticK(1/9 sqrt(30)) 
         - 4/3 sqrt(3) EllipticF(1/2 sqrt(3), 1/9 sqrt(30)) 
 
> evalf(%); 
                             5.546323855 
 
> evalf(Int(f(1,1/2,theta),theta=0..Pi/2)); 
 
                             2.156515648 
 
> evalf(Int(f(3/4,1/sqrt(2),theta),theta=0..Pi/2)); # It works here 
 
                             2.156515648
 

It is corrected with Maple 6. (U. Klein)

7.59.2 Heike Koch-Beuttenmueller (24.7.98)

You can avoid this bug in the following way:

It works for both problems:

p3:=int(f(1,1/2,theta),theta=0..t); 
              / 
  p3 := - 1/2 |(1 + cos(t)) sqrt(4) sqrt(2) 
              \ 
 
             3 cos(t) - I sqrt(3) + I sqrt(3) cos(t) + 1 
        sqrt(-------------------------------------------) 
                             1 + cos(t) 
 
               -6 cos(t) - 2 I sqrt(3) + 2 I sqrt(3) cos(t) - 2 
        sqrt(- ------------------------------------------------) 
                                  1 + cos(t) 
 
                      (-1 + cos(t)) sqrt(2 + 2 I sqrt(3)) 
        EllipticF(1/2 -----------------------------------, 
                                    sin(t) 
 
                                   \   / 
        1/2 sqrt(-2 - 2 I sqrt(3)))|  /  ( 
                                   / / 
 
                     2 
        sqrt(3 cos(t)  + 1) sqrt(2 + 2 I sqrt(3))) 
 
> p4:=int(f(3/4,1/sqrt(2),theta),theta=0..t); 
 
              / 
  p4 := - 4/3 |(1 + cos(t)) sqrt(2) 
              \ 
 
             cos(t) - 2 I sqrt(2) + 2 I sqrt(2) cos(t) + 8 
        sqrt(---------------------------------------------) 
                              1 + cos(t) 
 
               -2 cos(t) - 4 I sqrt(2) + 4 I sqrt(2) cos(t) - 16 
        sqrt(- -------------------------------------------------) 
                                  1 + cos(t) 
 
                      (-1 + cos(t)) sqrt(-7 + 4 I sqrt(2)) 
        EllipticF(1/3 ------------------------------------, 
                                     sin(t) 
 
                                    \   / 
        1/9 sqrt(17 + 56 I sqrt(2)))|  /  ( 
                                    / / 
 
                   2 
        sqrt(cos(t)  + 8) sqrt(-7 + 4 I sqrt(2))) 
 
> f3:=unapply(p3,t); 
 
                   / 
  f3 := t -> - 1/2 |(1 + cos(t)) sqrt(4) sqrt(2) 
                   \ 
 
             3 cos(t) - I sqrt(3) + I sqrt(3) cos(t) + 1 
        sqrt(-------------------------------------------) 
                             1 + cos(t) 
 
               -6 cos(t) - 2 I sqrt(3) + 2 I sqrt(3) cos(t) - 2 
        sqrt(- ------------------------------------------------) 
                                  1 + cos(t) 
 
                      (-1 + cos(t)) sqrt(2 + 2 I sqrt(3)) 
        EllipticF(1/2 -----------------------------------, 
                                    sin(t) 
 
                                   \   / 
        1/2 sqrt(-2 - 2 I sqrt(3)))|  /  ( 
                                   / / 
 
                     2 
        sqrt(3 cos(t)  + 1) sqrt(2 + 2 I sqrt(3))) 
 
> f4:=unapply(p4,t); 
 
                   / 
  f4 := t -> - 4/3 |(1 + cos(t)) sqrt(2) 
                   \ 
 
             cos(t) - 2 I sqrt(2) + 2 I sqrt(2) cos(t) + 8 
        sqrt(---------------------------------------------) 
                              1 + cos(t) 
 
               -2 cos(t) - 4 I sqrt(2) + 4 I sqrt(2) cos(t) - 16 
        sqrt(- -------------------------------------------------) 
                                  1 + cos(t) 
 
                      (-1 + cos(t)) sqrt(-7 + 4 I sqrt(2)) 
        EllipticF(1/3 ------------------------------------, 
                                     sin(t) 
 
                                    \   / 
        1/9 sqrt(17 + 56 I sqrt(2)))|  /  ( 
                                    / / 
 
                   2 
        sqrt(cos(t)  + 8) sqrt(-7 + 4 I sqrt(2)))
 

This looks more complicated.

> f3(Pi/2); 
 
  1/2 sqrt(4) sqrt(2) sqrt(1 - I sqrt(3)) EllipticF( 
 
        1/2 sqrt(2 + 2 I sqrt(3)), 1/2 sqrt(-2 - 2 I sqrt(3))) 
 
> evalf(%); 
 
                                               -9 
                   2.156515647 - .3744778224 10   I 
 
> f4(Pi/2); 
 
  1/6 sqrt(2) sqrt(8 - 2 I sqrt(2)) sqrt(16 + 4 I sqrt(2)) EllipticF( 
 
        1/3 sqrt(-7 + 4 I sqrt(2)), 1/9 sqrt(17 + 56 I sqrt(2))) 
 
        sqrt(8)/sqrt(-7 + 4 I sqrt(2)) 
 
> evalf(%); 
 
                                               -9 
                   2.156515649 - .1619270887 10   I 
 
> evalf(%%,20); 
 
                                                        -19 
        2.1565156474996432357 - .20833956398182576545 10    I
 

You get a small imaginary value,which must be due to rounding errors, so you can neglect it.

7.59.3 Herb Brown (24.7.98)

It is interesting that this works correctly in release 4:

> f:=(a,b,theta)->1/sqrt(a^2*cos(theta)^2+b^2*sin(theta)^2); 
 
                                             1 
     f := (a, b, theta) -> ------------------------------------- 
                                 2           2    2           2 
                           sqrt(a  cos(theta)  + b  sin(theta) ) 
 
> int(f(3/4,1/sqrt(2),theta),theta=0..Pi/2); 
 
                                  1/2  1/2       1/2 
                 2 EllipticF(1/3 3    2   , 1/2 3   ) 
 
> evalf(%); 
 
                             2.156515648