!***************************************************************** !* Test program for cubature over rectangles using Gauss * !* * !* ------------------------------------------------------------- * !* SAMPLE RUN: * !* (Integrate function EXP(-(x*x + y*y)) in rectangle defined by * !* x1=0, x2=10, y1=0, y2=10). * !* * !* ------------------------------------------------------ * !* # Error Value Error Function * !* Method code Integral Estimation calls * !* ------------------------------------------------------ * !* 0 ( 0) 0.27460788 16 * !* 1 ( 0) 0.94345609 64 * !* 2 ( 0) 0.77390367 144 * !* 3 ( 0) 0.78537787 256 * !* 4 ( 0) 0.78547216 400 * !* 5 ( 0) 0.78539063 576 * !* 6 ( 0) 0.78539862 784 * !* 7 ( 0) 0.78539814 1024 * !* 0 ( 0) 0.77973416 0.168375E+00 80 * !* 1 ( 0) 0.78676409 -0.522307E-01 320 * !* 2 ( 0) 0.78527076 0.378903E-02 720 * !* 3 ( 0) 0.78540422 0.878258E-05 1280 * !* 4 ( 0) 0.78539799 -0.247227E-04 2000 * !* 5 ( 0) 0.78539817 0.251254E-05 2880 * !* 6 ( 0) 0.78539816 -0.151354E-06 3920 * !* 7 ( 0) 0.78539816 0.626142E-08 5120 * !* ------------------------------------------------------ * !* * !* ------------------------------------------------------------- * !* Reference: * !* "Numerical Algorithms with C, By Gisela Engeln-Muellges * !* and Frank Uhlig, Springer-Verlag, 1996" [BIBLI 11]. * !* * !* F90 Release 1.0 By J-P Moreau, Paris. * !* (www.jpmoreau.fr) * !***************************************************************** Program TK4GAU implicit none real*8 a, b, c, d, W, F integer Nx, Ny, i, Verfahren integer mSCH !<>0: with eror estimate integer ncalls integer Kub4GauE Nx = 4; Ny = 4 a = 0.d0; c = 0.d0 b = 10.d0; d = 10.d0 print *,' -------------------------------------------------------' print *,' # Error Value Error Function ' print *,' Method code Integral Estimation calls ' print *,' -------------------------------------------------------' do mSCH = 0, 1 do Verfahren = 0, 7 ncalls = 0 i = Kub4GauE(a, b, Nx, c, d, Ny, Verfahren, W, mSCH, F, ncalls) if (mSCH.ne.0) then write(*,10) Verfahren, i, W, F, ncalls else write(*,20) Verfahren, i, W, ncalls end if end do end do print *,' -------------------------------------------------------' stop 10 format(I5,' (',I2,') ',F12.8,' ',e13.6,' ',I4) 20 format(I5,' (',I2,') ',F12.8,' ',I4) END !user defined function(x,y) to integrate real*8 Function func(x,y) implicit none real*8 x,y func = Exp(-(x*x+y*y)) return end !end of file tk4gau.f90