Let $x\_0<x\_1<\ldots<x\_n$ and $f\_0,f\_1,\ldots,f\_n$ be real numbers and
$$s\_i=(f\_i-f\_{i-1})/(x\_i-x\_{i-1}),~~~c\_i=(s\_{i+1}-s\_i)/(x\_{i+1}-x\_{i-1}).$$


If $f$ is a convex function defined on $[x\_0,x\_n]$ with $f(x\_i)=f\_i$ for $i=0,\ldots,n$ then all $c\_i$ are nonnegative. Conversely, this condition guarantees that a convex function $f$ with this property exists, namely the piecewise linear interpolant. Necessary and sufficient condition for realizing a twice continuously differentiable function $f$ are given in


R. Delbourgo, 
Shape preserving interpolation to convex data by rational functions with quadratic numerator and linear denominator, 
IMA J. Numer. Anal. 9 (1989), 123-136.


with an algorithm for constructing such a $C^2$ function that involves solving a nonlinear system of equations. Is there a simpler algorithm that does not require solving nonlinear equations?



algorithm for convex $C^2$ interpolation
If $c\_i$'s are all positive, there are infinitely many such convex $C^2$ functions. As I have pointed out in my comment above, nonnegativity of $c\_i$'s is insufficient to guarantee the existence of a $C^2$ function. One very simple construction via Bezier curve is as follows. 


Draw a straight line through each point $(x\_i,f\_i)$ such that all other points lie above the line. In each interval, construct a quartic [Bezier curve](https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Constructing_B%C3%A9zier_curves) as follows. Set the control points of the quadratic Bezier curve resulting from the previously drawn straight lines. Then make the midpoint of each line segment a control point (doubling the control number minus one). Draw the quartic Bezier curve from these control points. 


The reason for the construction is that the tangent vector (first derivative) with respect to the parameter ($t$ in the Wikipedia article) of a Bezier at an end point is the attached line segment while the second derivative of the curve is the difference of the two closest line segments. We are making the tangent vectors on both sides of the end (data) point coincide and the difference vectors vanish thus equal. You get a $C^2$ curve with a continuous first derivative and a continuous second derivative vanishing at each data point.


The above algorithm, proving the existence of the convex $C^2$ interpolation function, has a vanishing second derivative at each data point. That makes the first derivative run parallel to the $x$ axis each time the curve reaches a data point, making the first derivative wiggly. It does not have to Having proved the existence of an $C^2$ interpolation, we can make the first derivative of the convex $C^2$ interpolating curve smoother by constructing a higher order Bezier curve by connecting neighbouring data points with many small line segments of almost equal lengths each turning almost a constant angle. This will eliminate the horizontal running points from the first derivative and makes it appear smoother.


