public static double[][,] CreateCoefficients(int points)
{
// Compute difference coefficient table
double[][,] c = new double[points][,];
double fac = Special.Factorial(points);
for (int i = 0; i < points; i++)
{
double[,] deltas = new double[points, points];
for (int j = 0; j < points; j++)
{
double h = 1.0;
double delta = j - i;
for (int k = 0; k < points; k++)
{
deltas[j, k] = h / Special.Factorial(k);
h *= delta;
}
}
c[i] = Matrix.Inverse(deltas);
for (int j = 0; j < points; j++)
for (int k = 0; k < points; k++)
c[i][j, k] = (Math.Round(c[i][j, k] * fac, MidpointRounding.AwayFromZero)) / fac;
}
return c;
}