# Finding Bernstein coefficients for spline Thoughts: Since we have information up to the second derivative, we could use linear, quadratic, and cubic splines to solve the problem. I am stumped on how to find the coefficients, however.

(More thoughts: A linear spline is just connected line segments, so the coeffs would come from a line equation of sorts... right?)

## 1 Answer

You need a $5$th-order polynomial in every segment $[x_i,x_{i+1}]$ to fit the function values $f_i$, $f_{i+1}$, first-order derivatives $f_i'$, $f_{i+1}'$, and second-order derivatives $f_i''$, $f_{i+1}''$. To find the coefficients quickly, we need a good basis. For example, it's easy to find a linear function

$$y_1(x)=f_i+\frac{f_{i+1}-f_i}{x_{i+1}-x_i}(x-x_i)$$

that produces the correct function values $f_i,f_{i+1}$ at $x_i,x_{i+1}$. To get the derivatives right, we add two more cubic functions

$$y_3(x)=y_1(x)+a_3(x-x_i)(x-x_{i+1})^2+b_3(x-x_i)^2(x-x_{i+1}).$$

The good thing about the basis is that neither of them change the function values $f_i,f_{i+1}$, and that $a_3(x-x_i)(x-x_{i+1})^2$ has zero derivative at $x_{i+1}$ and $b_3(x-x_i)^2(x-x_{i+1})$ has zero derivative at $x_i$. So the coefficients can be determined independently from the derivatives $f_i',f_{i+1}'$. Once $y_3(x)$ is found, we find the $5$th-degree polynomial

$$y_5(x)=y_3(x)+a_5(x-x_i)^2(x-x_{i+1})^3+b_5(x-x_i)^3(x-x_{i+1})^2$$

in the same manner. The already satisfied conditions $f_i,f_{i+1}$ and $f_i',f_{i+1}'$ are not affected. The $a_5$ term has zero second-order derivative at $x_{i+1}$ and the $b_5$ term has zero second-order derivative at $x_i$. So the coefficients $a_5,b_5$ can again be determined from $f_i''$ and $f_{i+1}''$ independently.