Use your routines to compute the Gaussian integral
The results are given below.
SINGLE PRECISION | ||||
Tol | Trapezoidal | Simpson | ||
error | n | error | n | |
0.1E+01 | -.2E-01 | 0.5E-03 | ||
0.1E+00 | -.2E-01 | 0.4E-04 | ||
0.1E-01 | -.1E-02 | 0.4E-04 | ||
0.1E-02 | -.3E-03 | 0.4E-04 | ||
0.1E-03 | -.2E-04 | 0.3E-05 | ||
0.1E-04 | -.1E-05 | 0.2E-06 | ||
0.1E-05 | -.2E-06 | -.8E-07 | ||
0.1E-06 | -.2E-06 | 0.0E+00 | ||
0.1E-07 | -.1E-04 | 0.8E-07 | ||
0.1E-08 | -.1E-04 | 0.8E-07 | ||
0.1E-09 | -.1E-04 | 0.8E-07 | ||
0.1E-10 | -.1E-04 | 0.8E-07 | ||
0.1E-11 | -.1E-04 | 0.8E-07 |
DOUBLE PRECISION | ||||
TOL | Trapezoidal | Simpson | ||
error | n | error | n | |
0.1E+01 | -.2E-01 | 0.5E-03 | ||
0.1E+00 | -.2E-01 | 0.4E-04 | ||
0.1E-01 | -.1E-02 | 0.4E-04 | ||
0.1E-02 | -.3E-03 | 0.4E-04 | ||
0.1E-03 | -.2E-04 | 0.3E-05 | ||
0.1E-04 | -.1E-05 | 0.2E-06 | ||
0.1E-05 | -.3E-06 | 0.1E-07 | ||
0.1E-06 | -.2E-07 | 0.7E-09 | ||
0.1E-07 | -.1E-08 | 0.7E-09 | ||
0.1E-08 | -.3E-09 | 0.4E-10 | ||
0.1E-09 | -.2E-10 | 0.3E-11 | ||
0.1E-10 | -.1E-11 | 0.2E-12 | ||
0.1E-11 | -.3E-12 | 0.6E-14 |
Aside from the project, compare the results above with thre results obtained via Gaussian Quadrature integration formula. This method gives excellent results with only several node points; it is therefore much more efficient than both trapezoidal and Simpson rules.
Gauss Quadrature | |
error | n |
-3.0E-4 | 2 |
-1.2E-5 | 3 |
4.4E-7 | 4 |
-8.0E-9 | 5 |