Lably
Skip to content

Akima spline

Type of spline in applied mathematics

  • 2 min read
  • 1 chapter

Related on Lably

Through Weighted arithmetic mean and Differentiable function

Method

Given a set of "knot" points (xi,yi)i=1…n, where the xi are strictly increasing, the Akima spline will go through each of the given points. At those points, its slope, si, is a function of the locations of the points (xi−2,yi−2) through (xi+2,yi+2). Specifically, if we define mi as the slope of the line segment from (xi,yi) to (xi+1,yi+1), namely

mi=yi+1−yixi+1−xi,

then the spline slopes si are defined as the following weighted average of mi−1 and mi,

si=|mi+1−mi|mi−1+|mi−1−mi−2|mi|mi+1−mi|+|mi−1−mi−2|.

If the denominator equals zero, the slope is given as

si=mi−1+mi2.

The first two and the last two points need a special prescription, for example,

s1=m1,s2=m1+m22,sn−1=mn−2+mn−12,sn=mn−1.

The spline is then defined as the piecewise cubic function whose value between xi and xi+1 is the unique cubic polynomial Pi(x),

Pi(x)=ai+bi(x−xi)+ci(x−xi)2+di(x−xi)3,

where the coefficients of the polynomial are chosen such that the four conditions of continuity of the spline together with its first derivative are satisfied,

P(xi)=yi,P(xi+1)=yi+1,P′(xi)=si,P′(xi+1)=si+1.

which gives

ai=yi,
bi=si,
ci=3mi−2si−si+1xi+1−xi,
di=si+si+1−2mi(xi+1−xi)2.

Due to these conditions the Akima spline is a C1 differentiable function, that is, the function itself is continuous and the first derivative is also continuous. However, in general, the second derivative is not necessarily continuous.

An advantage of the Akima spline is due to the fact that it uses only values from neighboring knot points in the construction of the coefficients of the interpolation polynomial between any two knot points. This means that there is no large system of equations to solve and the Akima spline avoids unphysical wiggles in regions where the second derivative in the underlying curve is rapidly changing. A possible disadvantage of the Akima spline is that it has a discontinuous second derivative.

More in Topics in mathematics