private static void checkIncreasing(double[] xval)
{
for (int i = 0; i < xval.Length; ++i)
{
if (i >= 1 && xval[i - 1] > xval[i])
{
throw new ApplicationException(
string.Format("the abscissae array must be sorted in an increasing order, but the {0}-th element is {1} whereas {2}-th is {3}",
i - 1, xval[i - 1], i, xval[i]));
}
}
}