# How to find B-Spline represenation of an Akima spline?

Given points $t_i$ and values $y_i$, I'd like to use Akima interpolation to interpolate to a different set of locations $x_j$. This means I need to calculate the cubic polynomials $A_{3,t}(x)$. Given that these $A_{3,t}(x)$ are actually splines, it should be possible to find their B-Spline coefficients, i.e., $\alpha_l$ such that $A_{3,t}(x) = \sum_l \alpha_l\cdot B_{l,3,t}(x)$. Unfortunately, I'm at a total loss about how to do this =(

The brute force way just uses interpolation techniques. The Akima curve is a cubic spline that is $C_1$ at each knot. So, all of its interior knots are double knots (multiplicity two). So, if you have $n+1$ points, $(x_0, x_1, \ldots, x_n)$, your knot sequence will have the form $(x_0, x_0, x_0, x_0, x_1, x_1, \ldots, x_i, x_i, \ldots , x_n, x_n, x_n, x_n)$. So, you have $2n+6$ knot values, and using these, you can construct $2n+2$ cubic b-spline basis functions, $B_0, \ldots, B_{2n+1}$. The b-spline we want will be $$f(x) = \sum_{i=0}^{2n+1}\alpha_i B_i(x)$$ We can calculate the coefficients $\alpha_0, \ldots, \alpha_{2n+1}$ by interpolation. Choose $2n+2$ values $z_0, \ldots, z_{2n+1}$, and evaluate your Akima curve at these values to get $2n+2$ ordinate values $y_0, \ldots, y_{2n+1}$. Then solve the linear system $$y_j = \sum_{i=0}^{2n+1}\alpha_i B_i(z_j) \quad (j = 0, 1, \ldots, 2n+1)$$ to get the b-spline coefficients $\alpha_0, \ldots, \alpha_{2n+1}$. You have to choose the $z_j$ values with a bit of care, or else you'll end up with a linear system that does not have a unique solution. The crucial point here is that the interpolation problem has a unique solution. Since the b-spline curve and the Akima curve are both solutions, they must be the same curve.
The clever way is to just fabricate the $\alpha$ coefficients using the end-points and end tangents of the cubic segments in the Akima curve. Suppose the points are $(x_0, x_1, \ldots, x_n)$, again, and let $(y_0, y_1, \ldots, y_n)$ and $(d_0, d_1, \ldots, d_n)$ be the values and first derivatives of the Akima curve at these points. The b-spline control points are then: \begin{align} y_0 \quad &; \quad y_0 + \tfrac13 d_0 (x_1 - x_0) \\ y_1 - \tfrac13 d_1 (x_1 - x_0) \quad &; \quad y_1 + \tfrac13 d_1 (x_2 - x_1) \\ y_2 - \tfrac13 d_2 (x_2 - x_1) \quad &; \quad y_2 + \tfrac13 d_2 (x_3 - x_2) \\ &\vdots \\ y_i - \tfrac13 d_i (x_i - x_{i-1}) \quad &; \quad y_i + \tfrac13 d_i (x_{i+1} - x_i) \\ &\vdots \\ y_n - \tfrac13 d_n (x_n - x_{n-1}) \quad &; \quad y_n \end{align} This gives you $2n+2$ coefficients, as before. The knot sequence is the same as in the brute force approach above. Here's a picture
The black points represent the coefficients. The red points are the breaks between the cubic segments. We have 5 original data points, so $n=4$. This means we will have $2n+2 = 10$ coefficients.