/**************************************************************** * 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 1.684e-001 80 * * 1 ( 0) 0.78676409 -5.223e-002 320 * * 2 ( 0) 0.78527076 3.789e-003 720 * * 3 ( 0) 0.78540422 8.783e-006 1280 * * 4 ( 0) 0.78539799 -2.472e-005 2000 * * 5 ( 0) 0.78539817 2.513e-006 2880 * * 6 ( 0) 0.78539816 -1.514e-007 3920 * * 7 ( 0) 0.78539816 6.261e-009 5120 * * --------------------------------------------------- * * * * ------------------------------------------------------------- * * Reference: * * "Numerical Algorithms with C, By Gisela Engeln-Muellges * * and Frank Uhlig, Springer-Verlag, 1996" [BIBLI 11]. * * * * C++ Release 1.0 By J-P Moreau, Paris. * * (www.jpmoreau.fr) * ***************************************************************** Note: to link with f_beisp.cpp, kubgauss.cpp. ---------------------------------------------------------------*/ #include //For REAL, etc. int Kub4GauE ( REAL, REAL, int, REAL, REAL, int, int Verf, REAL f (REAL,REAL), REAL *, int, REAL * ); void main () { REAL a, b, c, d; REAL W, F; int Nx = 4, Ny = 4; int Verfahren; int mSCH; // with eror estimate REAL exp2 (REAL,REAL); // Function declared in F_Beisp.cpp extern int function_calls; // Variable declared in F_Beisp.cpp a = c = ZERO; b = d = TEN; printf(" ---------------------------------------------------\n"); printf(" # Error Value Error Function \n"); printf(" Method code Integral Estimation calls \n"); printf(" ---------------------------------------------------\n"); for (mSCH = 0; mSCH <= 1; mSCH++) for (Verfahren = 0; Verfahren <= 7; Verfahren++) { int i; function_calls = 0; i = Kub4GauE (a, b, Nx, c, d, Ny, Verfahren, exp2, // from F_Beisp.cpp &W, mSCH, &F); printf (" %d (%2d) %12.8f", Verfahren, i, W); if (mSCH) { if (F