Numerical Methods Contents - SAM
Numerical Methods Contents - SAM
Numerical Methods Contents - SAM
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
f<br />
f<br />
• line 9: estimate for global error by summing up moduli of local error contributions,<br />
• line 10: terminate, once the estimated total error is below the relative or absolute error threshold,<br />
• line 13 otherwise, add midpoints of mesh intervals with large error contributions according to<br />
(10.6.3) to the mesh and continue.<br />
Example 10.6.3 (h-adaptive numerical quadrature).<br />
100<br />
90<br />
80<br />
70<br />
60<br />
50<br />
40<br />
30<br />
20<br />
10<br />
quadrature errors<br />
10 0<br />
10 −1<br />
10 −2<br />
10 −3<br />
10 −4<br />
10 −5<br />
exact error<br />
estimated error<br />
approximate<br />
∫1<br />
0<br />
exp(6 sin(2πt)) dt, initial mesh M 0 = {j/10} 10<br />
j=0<br />
0<br />
0<br />
5<br />
10<br />
quadrature level<br />
15<br />
1<br />
0.8<br />
0.6<br />
x<br />
0.4<br />
0<br />
0.2<br />
Fig. 120<br />
10 1 no. of quadrature points<br />
10 −6<br />
10 −7<br />
10 −8<br />
0 100 200 300 400 500 600 700 800<br />
Fig. 121<br />
Algorithm: adaptive quadrature, Code 10.6.1<br />
Observation:<br />
Tolerances: rtol = 10 −6 , abstol = 10 −10<br />
We monitor the distribution of quadrature points during the adaptive quadrature and the true and<br />
estimated quadrature errors. The “exact” value for the integral is computed by composite Simpson<br />
rule on an equidistant mesh with 10 7 intervals.<br />
Ôº½ ½¼º<br />
Adaptive quadrature locally decreases meshwidth where integrand features variations or kinks.<br />
Trend for estimated error mirrors behavior of true error.<br />
Overestimation may be due to taking the modulus in (10.6.1)<br />
However, the important information we want to glean from EST k is about the distribution of the<br />
quadrature error.<br />
Ôº½ ½¼º<br />
500<br />
10 0<br />
exact error<br />
estimated error<br />
✸<br />
450<br />
400<br />
350<br />
10 −1<br />
10 −2<br />
Remark 10.6.4 (Adaptive quadrature in MATLAB).<br />
300<br />
250<br />
200<br />
150<br />
100<br />
50<br />
quadrature errors<br />
10 −3<br />
10 −4<br />
10 −5<br />
10 −6<br />
q = quad(fun,a,b,tol): adaptive multigrid quadrature<br />
(local low order quadrature formulas)<br />
q = quadl(fun,a,b,tol): adaptive Gauss-Lobatto quadrature<br />
△<br />
0<br />
0<br />
0<br />
5<br />
0.2<br />
0.4<br />
10<br />
0.6<br />
0.8<br />
15<br />
1<br />
x<br />
quadrature level<br />
Fig. 118<br />
∫1<br />
approximate min{exp(6 sin(2πt)), 100} dt,<br />
10 1 no. of quadrature points<br />
10 −7<br />
10 −8<br />
10 −9<br />
0 200 400 600 800 1000 1200 1400 1600<br />
initial mesh as above<br />
Fig. 119<br />
10.7 Multidimensional Quadrature<br />
0<br />
Ôº½ ½¼º<br />
Ôº¾¼ ½¼º