32 double min_dx = x[1] - x[0];
33 for (i = 2; i < N; i++) {
34 double dx = x[i] - x[i-1];
35 if (dx < min_dx) min_dx = dx;
37 double tol = 1e-10 * min_dx;
39 for (i = 0; i < N; i++) {
40 if (x[i] <= (b+tol)) *imax = i+1;
42 for (i = N-1; i > -1; i--) {
43 if (x[i] >= (a-tol)) *imin = i;
Contains function definitions for common mathematical functions.
void FindInterval(double a, double b, double *x, int N, int *imin, int *imax)