2081 9

CSC212 · 2081 · 5 marks

Given the data points below, find cubic spline which belongs to 1 leq x leq 3 and estimate f(2) using cubic splines.

Given the data points below, find cubic spline which belongs to $1 \leq x \leq 3$ and estimate $f(2)$ using cubic splines.

$$\begin{array}{c|ccc} x & 1.0 & 3.0 & 4.0 \ \hline f(x) & 1.5 & 4.5 & 9.0 \end{array}$$

[5]

Numerical MethodChapter 2: Interpolation and RegressionCubic spline interpolationNumerical: Cubic spline interpolation

Cubic Spline Interpolation on [1, 3], Estimate f(2)

Given

i$x_i$$f_i$
01.01.5
13.04.5
24.09.0

Number of intervals $n = 2$. We use natural cubic spline (standard assumption when no end conditions given).


Solution

Interval widths

$$h_0 = x_1 - x_0 = 2, \qquad h_1 = x_2 - x_1 = 1$$

Moment (second-derivative) equations

Natural boundary conditions: $M_0 = 0,\ M_2 = 0$.

Interior equation at $i=1$:

$$h_0 M_0 + 2(h_0+h_1)M_1 + h_1 M_2 = 6\left[\frac{f_2-f_1}{h_1} - \frac{f_1-f_0}{h_0}\right]$$

RHS:

$$\frac{f_2-f_1}{h_1} = \frac{9.0-4.5}{1} = 4.5, \qquad \frac{f_1-f_0}{h_0} = \frac{4.5-1.5}{2} = 1.5$$

$$\text{RHS} = 6(4.5-1.5) = 18$$

Substituting $M_0 = M_2 = 0$:

$$2(2+1)M_1 = 18 \Rightarrow 6M_1 = 18 \Rightarrow M_1 = 3$$

So $M_0 = 0,\ M_1 = 3,\ M_2 = 0$.

Spline on [1, 3]

$$S_0(x) = \frac{M_0}{6h_0}(x_1-x)^3 + \frac{M_1}{6h_0}(x-x_0)^3 + \left(\frac{f_0}{h_0}-\frac{M_0 h_0}{6}\right)(x_1-x) + \left(\frac{f_1}{h_0}-\frac{M_1 h_0}{6}\right)(x-x_0)$$

With $x_0=1,\ x_1=3,\ h_0=2$:

$$S_0(x) = \frac{3}{12}(x-1)^3 + \left(\frac{1.5}{2}\right)(3-x) + \left(\frac{4.5}{2}-\frac{3\cdot 2}{6}\right)(x-1)$$

$$S_0(x) = 0.25(x-1)^3 + 0.75(3-x) + (2.25-1)(x-1)$$

Simplify linear terms:

$$0.75(3-x) + 1.25(x-1) = 2.25 - 0.75x + 1.25x - 1.25 = 1 + 0.5x$$

$$\boxed{S_0(x) = 0.25(x-1)^3 + 0.5x + 1.0}$$

Estimate f(2)

Since $1 \le 2 \le 3$, use $S_0$:

$$f(2) = 0.25(2-1)^3 + 0.5(2) + 1.0 = 0.25(1) + 1.0 + 1.0 = 2.25$$

$$\boxed{f(2) = 2.25}$$


Summary

QuantityValue
$M_0, M_1, M_2$$0,\ 3,\ 0$
$S_0(x)$ on $[1,3]$$0.25(x-1)^3 + 0.5x + 1.0$
$f(2)$$\mathbf{2.25}$

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.