Accuracy of quad_ts



The integral of 1/sqrt(1-sin(x)^2*cos(y)^2) over [0,%pi/2]x[0,%pi/2]
is known to be elliptic_kc(1/2)^2=3.437592909010188....

The quad_qags function gives a quite accurate result: 3.437592909009772.
While quad_ts does not: 2.64797046523282. See the code below.
There is also a problem of using "x" as a variable name in the outer 
integral.

How do I get more accurate quad_ts' output?

quad_ts is not a part of Maxima distribution. It is presented by Edwin 
Woollett
in his Maxima by Example notes, chapter 9 (http://www.csulb.edu/~woollett/).

THE INPUT:

e : 1/sqrt(1-sin(x)^2*cos(y)^2);
integrate(integrate(e,y,0,%pi/2),x,0,%pi/2);
quad_qags(quad_qags(e,y,0,%pi/2)[1],x,0,%pi/2);
elliptic_kc(0.5)^2;
load("quad_ts");
quad_ts(lambda([x],quad_ts(lambda([y],''e),0,%pi/2,8,16)[1]),0,%pi/2,8,16);
e2 : e, x = z;
quad_ts(lambda([z],quad_ts(lambda([y],''e2),0,%pi/2,8,16)[1]),0,%pi/2,8,16);
quad_ts(lambda([z],quad_ts(lambda([y],''e2),0,%pi/2,30,40)[1]),0,%pi/2,30,40);

THE INPUT AND THE OUTPUT:

Maxima 5.19.2 http://maxima.sourceforge.net
Using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (aka GCL)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) e : 1/sqrt(1-sin(x)^2*cos(y)^2);
                                       1
(%o1)                      -------------------------
                                       2       2
                           sqrt(1 - sin (x) cos (y))
(%i2) integrate(integrate(e,y,0,%pi/2),x,0,%pi/2);
                    %pi  %pi
                    ---  ---
                     2    2
                   /    /
                   [    [                1
(%o2)              I    I    ------------------------- dy dx
                   ]    ]                2       2
                   /    /    sqrt(1 - sin (x) cos (y))
                    0    0
(%i3) quad_qags(quad_qags(e,y,0,%pi/2)[1],x,0,%pi/2);
(%o3)         [3.437592909009772, 3.8051339856792765E-11, 231, 0]
(%i4) elliptic_kc(0.5)^2;
(%o4)                          3.437592909010188
(%i5) load("quad_ts");
   _kmax% =  8   _epsfac% =  2
(%o5)          C:/Documents and Settings/user/maxima/quad_ts.mac
(%i6) 
quad_ts(lambda([x],quad_ts(lambda([y],''e),0,%pi/2,8,16)[1]),0,%pi/2,8,16)
;

Improper parameter in function definition for %ft:
7.8539816339744830961566084581988b-1 x + 
7.8539816339744830961566084581988b-1
#0: 
quad_ts(%%fg=lambda([y],1/sqrt(1-sin(x)^2*cos(y)^2)),a=0,b=%pi/2,rprec=8,fp=
16)
#1: 
%%fg(x=7.8539816339744830961566084581988b-1*x+7.8539816339744830961566084581
988b-1)
#2: 
quad_ts(%%fg=lambda([x],quad_ts(lambda([y],1/sqrt(1-sin(x)^2*cos(y)^2)),0,%p
i/2,8,16)[1]),a=0,b=%pi/2,rprec=8,fp=16)(quad_ts.mac line 468)
 -- an error.  To debug this try debugmode(true);
(%i7) e2 : e, x = z;
                                       1
(%o7)                      -------------------------
                                       2       2
                           sqrt(1 - cos (y) sin (z))
(%i8) 
quad_ts(lambda([z],quad_ts(lambda([y],''e2),0,%pi/2,8,16)[1]),0,%pi/2,8,16
);
 construct _yw%[kk,fpprec] array for kk =  8  and fpprec =  16 
...working...
(%o8)           [2.64797046523282b0, 3, 9.686695889854491b-14]
(%i9) 
quad_ts(lambda([z],quad_ts(lambda([y],''e2),0,%pi/2,30,40)[1]),0,%pi/2,30,
40);
 construct _yw%[kk,fpprec] array for kk =  8  and fpprec =  40 
...working...
(%o9) [2.647970465232819540572758793717211146592b0, 5,
                                 2.755064884739736346801726259114638307387b-40]
(%i10) 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quad_ts_test.wxmx
Type: application/octet-stream
Size: 1378 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20100226/785ed9c0/attachment.obj>;