3.5 KB · commit a9602da
The governing equations of a cubic spline have been discussed in detail in Section 5.2, where the cubic spline function has been obtained in terms of its second derivatives, Mi. In certain applications, e.g. the solution of initial-value problems, it would be convenient to use the governing equations in terms of its first derivatives, i.e., mi. Using Hermite’s interpolation formula (see Section 3.9.3), it would not be difficult to derive the following formula for the cubic spline s(x) in xi−1≤x≤xi in terms of its first derivatives s′(xi)=mi:
s(x)=mi−1h2(xi−x)2(x−xi−1)−mih2(x−xi−1)2(xi−x)+yi−1h3(xi−x)2[2(x−xi−1)+h]+yih3(x−xi−1)2[2(xi−x)+h],(8.35)where h=xi−xi−1. Differentiating Eq. (8.35) with respect to x and simplifying, we obtain
s′(x)=h2mi−1(xi−x)(2xi−1+xi−3x)−h2mi(x−xi−1)(xi−1+2xi−3x)+h36(yi−yi−1)(x−xi−1)(xi−x).(8.36)Again,
s′′(x)=−h22mi−1(xi−1+2xi−3x)−h22mi(2xi−1+xi−3x)+h36(yi−yi−1)(xi−1+xi−2x),(8.37)which gives
s′′(xi)=h2mi−1+h4mi−h26(yi−yi−1)=h2mi−1+h4mi−h26(si−si−1).(8.38)If we now consider the initial-value problem dxdy=f(x,y)(8.39a) and y(x0)=y0(8.39b) then from Eq. (8.39a), we obtain dx2d2y=∂x∂f+∂y∂fdxdy, or
y′′(xi)=fx(xi,yi)+fy(xi,yi)f(xi,yi)=fx(xi,si)+fy(xi,si)f(xi,si).(8.40)Equating Eqs. (8.38) and (8.40), we obtain h2mi−1+h4mi−h26(si−si−1)=fx(xi,si)+fy(xi,si)f(xi,si)(8.41) from which si can be computed. Substitution in Eq. (8.35) gives the required solution.
The following example demonstrates the usefulness of the spline method.