Fundamentals / Numerical mathematics / Approximation and quadrature

Smooth pieces and integrated loads

Build a constrained trajectory, infer a spline curvature, and check quadrature by energy conservation over a measured interval.

Connect two resting positions

A carriage moves from 0 to 4 m in two seconds, starting and finishing at rest. Find the unique cubic trajectory satisfying these four endpoint data. Determine midpoint speed and the two endpoint accelerations. Can this cubic join a stationary segment with continuous acceleration?

Worked solution

With \(s=t/2\) the trajectory is \(4(3s^2-2s^3)\). Differentiating with respect to time gives \(v=12s(1-s)\) m/s, so \(v(1\ {\rm s})=3\) m/s. Acceleration is \(6(1-2s)\) m/s², giving \(+6\) and \(-6\) at the endpoints.

The velocity can join rest continuously. The stationary segment has zero acceleration, so this particular cubic cannot also give a continuous acceleration there. Enforcing both endpoint accelerations adds two constraints, motivating a higher-degree segment.

Explore the related calculation with adjustable inputs. Vary a slope or endpoint value and examine how an interpolant changes between observations. Map this exercise’s interval to the unit interval before comparing the basis functions.

Identify what a natural endpoint buys

At \(x=0,1,2\) a rod has displacements \(0,2,0\). Construct the first segment of the natural cubic spline and find its slope at 0 and its value at 0.5. Compare with the quadratic through all three data.

Worked solution

The natural curvatures are

\[M_0=M_2=0.\]

The interior equation gives \(4M_1=6(0-4+0)=-24\), so \(M_1=-6\). Integrate \(S''=-6x\) and impose the first two values to get

\[S=3x-x^3.\]

The initial slope is 3 and midpoint value 1.375.

The global quadratic is \(4x-2x^2\), with initial slope 4 and midpoint value 1.5. Both match every measured value. The difference is detectable in unmeasured derivatives and in the interior prediction because the quadratic has nonzero end curvature.

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.

Recover a missing quadratic load

On a unit-width panel a power signal is quadratic. Its endpoint values are 2 W and 6 W; its measured energy over one second is 3 W·s. Infer its midpoint value, compare the midpoint and trapezoidal estimates, and determine the sign of curvature.

Worked solution

Simpson integrates the quadratic exactly, so \(3=(2+4P_m+6)/6\), giving \(P_m=2.5\) W. The midpoint estimate is 2.5 J and the trapezoidal estimate is 4 J. Their weighted combination \((2\cdot2.5+4)/3=3\) J reproduces the measured energy.

The signal midpoint lies below the endpoint chord value 4 W, so the curvature is positive. These conclusions use the stipulated quadratic law; the same three observations cannot uniquely determine an arbitrary power history.

Explore the related calculation with adjustable inputs. Compare errors from common-node composite rules; the explorer uses an exponential reference, while the polynomial identities in this exercise can be checked exactly.

Does three-level extrapolation integrate every smooth input exactly?

For \(f(x)=x^6\) on \([0,1]\), the trapezoids with one, two and four panels are \(1/2,\ 33/128,\ 1421/8192\). Compute the two first-column corrections and the final diagonal value. Compare it with the exact integral and identify the first uncancelled error power.

Worked solution

Removing the quadratic terms gives

\[R_{1,1}=(4(33/128)-1/2)/3=17/96,\]
\[R_{2,1}=(4(1421/8192)-33/128)/3=893/6144.\]

Removing the quartic term gives

\[(16(893/6144)-17/96)/15=55/384.\]

The exact value is \(1/7\), so the excess is \(1/2688\). Both cancellations were exact algebraically, but the trapezoid expansion for this polynomial also contains an \(h^6\) term. Three grids remove two independent error coefficients. Exact integration of every smooth function cannot follow from that finite information.

Explore the related calculation with adjustable inputs. Compare trapezoidal and extrapolated estimates as the power of the integrand changes; track when the smooth-error expansion needed for cancellation is valid.

Revisit chapter 4 · Build a Romberg table from nested panels.

Recover an integral using two biased readings

The four- and eight-interval integrals of the quadratic profile are 306.875 and 306.71875 K·m. Assume their leading error is \(Ch^2\). Eliminate \(C\) to estimate the integral and predict the sixteen-interval output. Explain why this elimination is exact for this model on uniform grids but needs a refinement check for arbitrary data.

Work through the solution

Write \(I_h=I+Ch^2\) and \(I_{h/2}=I+Ch^2/4\). Subtract the first relation from four times the second to get \(I=(4I_{h/2}-I_h)/3=306.66667\) K·m. The eight-interval bias is 0.0520833 K·m. Dividing by four gives a sixteen-interval prediction of 306.67969 K·m. Constant curvature makes the trapezoidal error exactly proportional to \(h^2\) for this quadratic. Curvature variation, lack of smoothness or measurement noise can spoil the assumed ratio.

Use the OneSimulation laboratory to check your answer