MTH-812 Adv. Engg. Mathematics
Cubic Spline
Dr. Yasir Ali (yali@ceme.nust.edu.pk)
DBS&H, CEME-NUST
December 4, 2017
Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
Interpolation Problem
Given 1 The (n + 1) nodes: x0, x1, ..., xn
2 The functional values f0, f1, ..., fn at these nodes
3 An Intermediate (nontabulated) point: xI
Predict fI : the value at x = xI.
Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
Given data (function values, points in the
xy-plane)(x0, f0), (x1, f1), ..., (xn, fn) can be interpolated
by a polynomial of degree n or less so that the curve of
Pn(x) passes through these points xi, fi.
Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
Given data (function values, points in the
xy-plane)(x0, f0), (x1, f1), ..., (xn, fn) can be interpolated
by a polynomial of degree n or less so that the curve of
Pn(x) passes through these points xi, fi.
Now if n is large, there may be trouble: may tend to oscillate for x
between the nodes x0, x1, ..., xn. Hence we must be prepared for
numeric instability
Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
Instead of using a single high-degree polynomial Pn(x) over
the entire interval a ≤ x ≤ b in which the nodes lie, that is,
a = x0 < x1 < x2 < · · · < xn−1 < xn = b
we use n low-degree, e.g., cubic, polynomials
S0(x), S1(x), S2(x), · · · , Sn−1(x)
one over each subinterval between adjacent nodes, hence S0(x) from x0
to x1, S1(x) from x1 to x2 and so on.
Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
Instead of using a single high-degree polynomial Pn(x) over
the entire interval a ≤ x ≤ b in which the nodes lie, that is,
a = x0 < x1 < x2 < · · · < xn−1 < xn = b
we use n low-degree, e.g., cubic, polynomials
S0(x), S1(x), S2(x), · · · , Sn−1(x)
one over each subinterval between adjacent nodes, hence S0(x) from x0
to x1, S1(x) from x1 to x2 and so on. From this we compose an
interpolation function called a spline g(x), by fitting these
polynomials together into a single continuous curve passing
through the data points, that is,
g(x0) = f(x0), g(x0) = f(x0), · · · , g(xn) = f(xn)
Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
g(x) =



S0(x), x0 ≤ x ≤ x1;
S1(x), x1 ≤ x ≤ x2;
· · · , · · · ;
Sj(x), xj ≤ x ≤ xj+1;
· · · , · · · ;
Sn−1(x), xn−1 ≤ x ≤ xn.
Thus spline interpolation is piecewise polynomial interpolation.
Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
g(x) =



S0(x), x0 ≤ x ≤ x1;
S1(x), x1 ≤ x ≤ x2;
· · · , · · · ;
Sj(x), xj ≤ x ≤ xj+1;
· · · , · · · ;
Sn−1(x), xn−1 ≤ x ≤ xn.
Thus spline interpolation is piecewise polynomial interpolation.
The most common piecewise-polynomial approximation uses cubic
polynomials between each successive pair of nodes and is called cubic
spline interpolation. A general cubic polynomial involves four
constants, so there is sufficient flexibility in the cubic spline procedure
to ensure that the interpolant is not only continuously differentiable on
the interval, but also has a continuous second derivative. The
construction of the cubic spline does not, however, assume that the
derivatives of the interpolant agree with those of the function it is
approximating, even at the nodes.
Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics

Interpolation of Cubic Splines

  • 1.
    MTH-812 Adv. Engg.Mathematics Cubic Spline Dr. Yasir Ali (yali@ceme.nust.edu.pk) DBS&H, CEME-NUST December 4, 2017 Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
  • 2.
    Interpolation Problem Given 1The (n + 1) nodes: x0, x1, ..., xn 2 The functional values f0, f1, ..., fn at these nodes 3 An Intermediate (nontabulated) point: xI Predict fI : the value at x = xI. Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
  • 3.
    Given data (functionvalues, points in the xy-plane)(x0, f0), (x1, f1), ..., (xn, fn) can be interpolated by a polynomial of degree n or less so that the curve of Pn(x) passes through these points xi, fi. Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
  • 4.
    Given data (functionvalues, points in the xy-plane)(x0, f0), (x1, f1), ..., (xn, fn) can be interpolated by a polynomial of degree n or less so that the curve of Pn(x) passes through these points xi, fi. Now if n is large, there may be trouble: may tend to oscillate for x between the nodes x0, x1, ..., xn. Hence we must be prepared for numeric instability Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
  • 5.
    Instead of usinga single high-degree polynomial Pn(x) over the entire interval a ≤ x ≤ b in which the nodes lie, that is, a = x0 < x1 < x2 < · · · < xn−1 < xn = b we use n low-degree, e.g., cubic, polynomials S0(x), S1(x), S2(x), · · · , Sn−1(x) one over each subinterval between adjacent nodes, hence S0(x) from x0 to x1, S1(x) from x1 to x2 and so on. Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
  • 6.
    Instead of usinga single high-degree polynomial Pn(x) over the entire interval a ≤ x ≤ b in which the nodes lie, that is, a = x0 < x1 < x2 < · · · < xn−1 < xn = b we use n low-degree, e.g., cubic, polynomials S0(x), S1(x), S2(x), · · · , Sn−1(x) one over each subinterval between adjacent nodes, hence S0(x) from x0 to x1, S1(x) from x1 to x2 and so on. From this we compose an interpolation function called a spline g(x), by fitting these polynomials together into a single continuous curve passing through the data points, that is, g(x0) = f(x0), g(x0) = f(x0), · · · , g(xn) = f(xn) Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
  • 7.
    g(x) =    S0(x), x0≤ x ≤ x1; S1(x), x1 ≤ x ≤ x2; · · · , · · · ; Sj(x), xj ≤ x ≤ xj+1; · · · , · · · ; Sn−1(x), xn−1 ≤ x ≤ xn. Thus spline interpolation is piecewise polynomial interpolation. Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
  • 8.
    g(x) =    S0(x), x0≤ x ≤ x1; S1(x), x1 ≤ x ≤ x2; · · · , · · · ; Sj(x), xj ≤ x ≤ xj+1; · · · , · · · ; Sn−1(x), xn−1 ≤ x ≤ xn. Thus spline interpolation is piecewise polynomial interpolation. The most common piecewise-polynomial approximation uses cubic polynomials between each successive pair of nodes and is called cubic spline interpolation. A general cubic polynomial involves four constants, so there is sufficient flexibility in the cubic spline procedure to ensure that the interpolant is not only continuously differentiable on the interval, but also has a continuous second derivative. The construction of the cubic spline does not, however, assume that the derivatives of the interpolant agree with those of the function it is approximating, even at the nodes. Dr. Yasir Ali (yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
  • 9.
    Dr. Yasir Ali(yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
  • 10.
    Dr. Yasir Ali(yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
  • 11.
    Dr. Yasir Ali(yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics
  • 12.
    Dr. Yasir Ali(yali@ceme.nust.edu.pk) MTH-812 Adv. Engg. Mathematics