Example: The shape preserving cubic spline interpolant

A cubic spline interpolant to a function is computed consistent with the concavity of the data. The spline value at 0.05 is printed.
import com.imsl.math.*;

public class CsShapeEx1 {
    public static void main(String args[]) throws com.imsl.IMSLException {
        double	x[] = {0.00, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.80, 1.00};
        double	y[] = {0.00, 0.90, 0.95, 0.90, 0.10, 0.05, 0.05, 0.20, 1.00};
        
        CsShape cs = new CsShape(x, y);
        double csv =  cs.value(0.05);
        System.out.println("The computed cubic spline value at point .05 is "
        + csv);
    }
}

Output

The computed cubic spline value at point .05 is 0.5582312228648201
Link to Java source.