The density of liquid water is tabulated at four temperatures
PHYSICS · Multi-part · Fermi University Physics · Mathematical Methods for Physics · Numerical and computational mathematics · Numerical and computational mathematics
Computational Physics, Ch Where a function vanishes, and what lies between the points
Problem
The density of liquid water ρ is tabulated at four temperatures, equally spaced by 10∘C. Treat these four readings as exact.
T (∘C)
0
10
20
30
ρ (kgm−3)
999.84
999.70
998.21
995.65
((a)) Construct the Lagrange interpolating cubic through all four points and use it to estimate ρ at T=15∘C.
((b)) A natural cubic spline is to be built through the same four points, with natural end conditions M0=M3=0, where Mi=S′′(xi) is the spline's second derivative at node i. Using the equal spacing h=10∘C, write down the tridiagonal system satisfied by the two interior second derivatives M1 and M2 (at T=10∘C and T=20∘C), and solve it by a forward elimination (a Thomas sweep) followed by back-substitution.
((c)) Evaluate the spline's cubic piece on [10,20] at T=15∘C and compare the result with part (a).
((d)) Evaluate the first derivative of the spline piece on [0,10] at T=10∘C from the left, and the first derivative of the piece on [10,20] at T=10∘C from the right, and confirm that they agree.