Example: The B-spline interpolant

A B-Spline interpolant to data is computed. The value of the spline at point .23 is printed.
using System;
using Imsl.Math;

public class BsInterpolateEx1
{
    public static void  Main(String[] args)
    {
        int n = 11;
        double[] x = new double[n];
        double[] y = new double[n];
        
        double h = 2.0 * System.Math.PI / 15.0 / 10.0;
        for (int k = 0; k < n; k++)
        {
            x[k] = h * (double) (k);
            y[k] = System.Math.Sin(15.0 * x[k]);
        }
        
        BsInterpolate bs = new BsInterpolate(x, y);
        double bsv = bs.Eval(0.23);
        Console.Out.WriteLine("The computed B-spline value at point " 
                               + ".23 is " + bsv);
    }
}

Output

The computed B-spline value at point .23 is -0.303418399276769

Link to C# source.