Fundamentals / Numerical mathematics / Approximation and quadrature

Accuracy with few evaluations

Derive mapped Gaussian weights, expose an underintegrated element and design a tolerance check for a sharply localised signal.

Map a rule and check its units

Use the two-node Gauss rule to integrate \(x^2\) over \([1,4]\). Give physical nodes and weights. Compare with the exact antiderivative, then explain what happens if the reference weights are used without the mapping factor.

Worked solution

The midpoint is 2.5 and half-length is 1.5, so nodes are \(2.5\pm1.5/\sqrt3\) and weights are both 1.5. The sum of squared nodal values is \(2[2.5^2+(1.5/\sqrt3)^2]=14\), giving integral 21. The antiderivative gives

\[(64-1)/3=21.\]

Using weights equal to one would report 14. When \(x\) is measured in metres, the weights carry metres and the integral carries m³. Ignoring the Jacobian is a scale error as well as a dimensional inconsistency.

Try this calculation. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.

Measure mass of an alternating displacement

On \(0\leq x\leq1\), linearly interpolate nodal values \((1,-1)\). Compute the exact squared norm, the one-point midpoint approximation and the two-point Gauss result. Explain which field escapes the one-point sampling.

Worked solution

Linear interpolation gives \(u=1-2x\), so

\[\int_0^1 u^2dx=1-2+4/3=1/3.\]

The midpoint value is zero, giving zero numerical norm with one point. The two Gauss nodes are \(1/2\pm1/(2\sqrt3)\), where \(u=\mp1/\sqrt3\). Weights \(1/2\) give \(1/3\).

The field changes sign inside the element and its node lies exactly at the one-point sample. Treating zero discrete norm as proof of zero field would introduce a spurious unconstrained mode.

Try this calculation. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.

Interpret an adaptive estimate

For a smooth interval, one Simpson panel gives 1.2000 and two half-panels give 1.1850. Estimate the signed correction, the corrected integral and whether an assigned tolerance of 0.0005 is met. Separately, a narrow pulse is known to lie between two sample positions. How would you modify the initial partition?

Worked solution

The correction to the fine value is

\[(1.1850-1.2000)/15=-0.0010.\]

The extrapolated estimate is 1.1840. The local error indicator 0.0010 exceeds the budget, so refine both halves and reuse the existing nodal evaluations.

For a pulse with known edges, introduce breakpoints at the edges and sample its interior. An indicator assembled from two rules that both miss the pulse can be zero even when the physical integral is finite.

Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.

Notebook practice · Three nodes sampling a Gaussian ensemble