6.8 KB · commit a9602da
The cubic splines derived in the previous section can be extended to functions of two or more variables. We derive the formulae for functions of two variables, the extension to higher dimensions being straightforward.** Let Li(x) be natural cubic splines which satisfy Li(xj)=δij={1,0,j=ij=i.(5.51)
These splines bear the same relation to the general cubic spline as the Lagrange polynomials bear to the Lagrange interpolation polynomial. Due to this reason, we call them cardinal splines. Let s(x) be the natural cubic spline, in xj−1≤x≤xj, corresponding to the set of data points (xj,yj), j=0,1,2,…,n. Then, Li(x) are the cardinal splines corresponding to the set of data points (xj,δi,j), where δi,j is the Kronecker delta defined above.
The cardinal splines are given by
Li(x)=h1[3!(xj−x)3Mi,j−1+3!(x−xj−1)3Mi,j+(xj−x)(δi,j−1−3!h2Mi,j−1)+(x−xj−1)(δi,j−3!h2Mi,j)],(5.52)where Mi,j=Li′′(xj). It is easy to verify that Eq. (5.52) satisfies conditions (5.51). As in the case of general splines, the condition of continuity of the first derivatives leads to the recurrence relation Mi,j−1+4Mi,j+Mi,j+1=h26(δi,j−1−2δi,j+δi,j+1).(5.53)
In terms of the cardinal splines Li(x), the general spline s(x), in the interval xj−1≤x≤xj, can be written as s(x)=i=0∑nLi(x)yi,(5.54) where Li(x) are given by Eq. (5.52).
Extension to functions of two variables is now quite straightforward. Let the values z(xi,yi),i=0,1,2,…,n of a function of two variables, z=f(x,y), be given at the n2 data points arranged at the intersections of a rectangular mesh. The interpolation problem now is to determine the value of z at an arbitrary point in the rectangular region. The cubic spline formula is given by s(x,y)=i=0∑nj=0∑nLi(x)Lj(y)zi,j,(5.55) where Li(x) and Lj(y) are given by formulae of the type given in Eq. (5.52). The spline second derivatives, Mij, are calculated from the recurrence relation (5.53) by imposing the natural end conditions, Mi,0=Mi,n=0.
The following examples demonstrate the use of the formulae derived above.
Li(x)=6(2−x)3Mi,0+6(x−1)3Mi,1+(2−x)(δi,0−61Mi,0)+(x−1)(δi,1−61Mi,1)=6(x−1)3Mi,1+(2−x)δi,0+(x−1)(δi,1−61Mi,1),(i)since Mi,0=0 for the natural cubic spline. Similarly, the recurrence relation (5.53), becomes: 4Mi,1=6(δi,0−2δi,1+δi,2), from which we obtain M0,1=23,M1,1=−3,M2,1=23. Hence, (i) gives:
\begin{aligned} L_0(x) &= \frac{(x - 1)^3}{6}\left(\frac{3}{2}\right) + (2 - x) + (x - 1)\left(-\frac{1}{4}\right) = \frac{1}{4}(x - 1)^3 - \frac{5}{4}x + \frac{9}{4}, \tag{ii} \\ L_1(x) &= -\frac{1}{2}(x - 1)^3 + \frac{3}{2}(x - 1), \tag{iii} \\ L_2(x) &= \frac{1}{4}(x - 1)^3 - \frac{1}{4}(x - 1). \tag{iv} \end{aligned}Hence, in 1≤x≤2, the general natural cubic spline is given by
s(x)=i=0∑2yiLi(x)=[41(x−1)3−45x+49](−8)+[23(x−1)−21(x−1)3](−1)+[41(x−1)3−41(x−1)](18)=3(x−1)3+4x−12,which is the same as that obtained in Example 5.3. The next example demonstrates the use of cardinal splines in surface fitting. ◀
| y\x | 0 | 1 | 2 |
|---|---|---|---|
| 0 | 1 | 2 | 9 |
| 1 | 2 | 3 | 10 |
| 2 | 9 | 10 | 17 |
For determining z(0.5,0.5), we need to obtain the natural cubic spline for the interval 0≤x,y≤1. With h=1, j=1, we have
Li(x)=6(1−x)3Mi,0+6x3Mi,1+(1−x)(δi,0−61Mi,0)+x(δi,1−61Mi,1)=6x3Mi,1+(1−x)δi,0+x(δi,1−61Mi,1),(i)since Mi,0=0 for the natural cubic spline. Also, Mi,1=23(δi,0−2δi,1+δi,2). Hence, we obtain M0,1=23,M1,1=−3,M2,1=23. From Eq. (i), we then obtain
L0(x)L1(x)L2(x)=4x3−45x+1,=−21x3+23x,=41x3−41x.Hence, in 0≤x,y≤1, we have
s(x,y)=i=0∑2j=0∑2Li(x)Lj(y)zi,j=L0(x)[L0(y)z0,0+L1(y)z0,1+L2(y)z0,2]+L1(x)[L0(y)z1,0+L1(y)z1,1+L2(y)z1,2]+L2(x)[L0(y)z2,0+L1(y)z2,1+L2(y)z2,2].Since x=y=0.5, the preceding equation gives:
z(0.5,0.5)≈s(0.5,0.5)=3213(3213×1+1611×2−323×9)+1611(3213×2+1611×3−323×10)−323(3213×9+1611×10−323×17)=0.875.The tabulated function is z=x3+y3+1 and therefore the exact value of z(0.5,0.5) is 1.25, which means that the above interpolated value has an error of 30%. ◀
**See, Ichida and Kiyono [1974].