/// <summary>
/// Computes the Basic Spline of order <c>n</c>
/// </summary>
public static double BSpline(int n, double x)
{
// ftp://ftp.esat.kuleuven.ac.be/pub/SISTA/hamers/PhD_bhamers.pdf
// http://sepwww.stanford.edu/public/docs/sep105/sergey2/paper_html/node5.html
if (n == Int32.MaxValue)
{
throw new ArgumentOutOfRangeException("n");
}
double a = 1.0 / Special.Factorial(n);
double c;
bool positive = true;
for (int k = 0; k <= n + 1; k++)
{
c = Binomial(n + 1, k) * Tools.TruncatedPower(x + (n + 1.0) / 2.0 - k, n);
a += positive ? c : -c;
positive = !positive;
}
return(a);
}