Generalizing to Many Points

We are going to fit a Hermite cubic between each pair of points. The above discussion finds the Hermite cubic between x=0 and x=1. Between x=1 and x=2 we will have a different cubic. We could get this with new boundary conditions u(1)=e, u'(1)=f, u(2)=g, u'(2)=h. For generalizing solutions, however, we will be more systematic, using subscripts.

Let our x values be 1, 2, 3, . . . .
Let uk represent u(k), and let sk represent u'(k) ("s" for slope).
The uk will be given to us (they are the y values of the points we need to get a curve through), but how do we find the sk?

The idea is to think of bending a beam (at the x values) to give it the proper heights (at the y values). Strang describes this as "having rings at these points, and the beam going through the rings. At all other points the force is zero, the beam is free to choose its own shape, and the solution to the beam equation u''''=0 is an ordinary cubic.... ... at an interpolation point, the ring imparts a concentrated load of unknown magnitude fk...." Let's assume the loads are at
x=0, 1, 2, . . . as we stated above.

We have seen this before, using the Dirac Delta function (DDF). At x=0 we have u''''=f0*DDF(x).
This implies that u''' is a step function (Heaviside function). u''' is constant on each side of 0 and these constants differ by f0. Similarly, at x=1 u''' has a step of f1 (since at x=1 we have u''''=f1*DDF(x-1) ). This continues through as many points as we need.
At the next step, u'' is continuous because the integrals of Heaviside functions are continuous. It is the continuity of u'' that will enable us to "connect" the different pieces of the spline.

To the left of x=0, the beam is straight (with no curvature) so u''=0 approaching from the left of x=0. [[Note: For u=u(x), the curvature is (|u''|/[1+(u')^2]^(3/2)]] Since u'' is to be continuous, we require u''=0 approaching from the right of x=0.

Let's rewrite hermite[x] to contain u0, s0, u1, s1 instead of a, b, c, d. We do this by substituting our initial conditions on u''''=0.


  hc1=hermite[x,u0,s0,u1,s1]


  We require u''=0 (that is hc1''=0) approaching from the right of x=0.


  D[hc1,{x,2}]/.x->0

Answer

Answer ...

Moving on to x=1, we need to piece together two hermite cubics. The first one is on the interval x=0 to x=1. This is hc1 above. The second one will have k=1 in place of k=0 and k=2 in place of k=1. In addition, we are shifting the hermite cubic one unit to the right (from x=0 to x=1) so we need to replace x with x-1. In the initial conditions to the differential equation, this shifting will change the initial conditions to u(1)=a, u'(1)=b, u(2)=c, u'(2)=d.


  hc2=hermite[x-1,u1,s1,u2,s2];
  Simplify[hc2]

The continuity of u'' means that we require hc1'' as x approaches 1 from the left to equal hc2'' as x approaches 1 from the right.


  D[hc1,{x,2}] /.x->1
  D[hc2,{x,2}] /.x->1

Answer

Answer ...

Let's do one more to nail down the pattern. Moving on to x=2, we again need to piece together two hermite cubics. The first one is on the interval x=1 to x=2. This is hc2 above. The second one will have k=2 in place of k=1 and k=3 in place of k=2. In addition, we are shifting the hermite cubic one more unit to the right (from x=1 to x=2) so we need to replace x with x-2.

Let's do our replacing:


  hc3=hermite[x-2,u2,s2,u3,s3];
  Simplify[hc3]

The continuity of u'' means that we require hc2'' as x approaches 2 from the left to equal hc3'' as x approaches 2 from the right.


  D[hc2,{x,2}] /.x->2
  D[hc3,{x,2}] /.x->2

Answer

Answer ...

To determine what happens at our last point, let's suppose it is x=3. In this situation, u''=0 beyond x=3 (our last point) just like at our first point (zero curvature at ends). So hc3'' must equal 0 as x approaches 3 from the left.


  D[hc3,{x,2}]/.x->3

Answer

Setting this equal to zero yields
s2+2s3=3(u3-u2).

These equations yield a beautiful matrix equation. It is As=delta(u) which is best described by looking at our small example:


  m={{2,1,0,0},{1,4,1,0},{0,1,4,1},{0,0,1,2}};
  s={s0,s1,s2,s3};
  du={u1-u0,u2-u0,u3-u1,u3-u2};
  Print[MatrixForm[m]," ",ColumnForm[s]," = ",ColumnForm[du]]

OK, we have the s (slope) values, what do we do with them?
Recall the Hermite cubic:


  hermite[x,a,b,c,d]

Remember that a is the value of hermite at the LEFT end of the interval (originally it was hermite[0]). The variable b is the value of the derivative of hermite[x] at the LEFT end of the interval. The variable c is the value of hermite[x] at the RIGHT end of the interval, and d is the value of the derivative of hermite[x] at the RIGHT end of the interval. The derivatives are the slopes, s, and the values of hermite[x] are the u values.

Up to The Theory (Equally Spaced Points)