Next: , Previous: Root Finding Iteration, Up: One dimensional Root-Finding   [Index]

### 34.7 Search Stopping Parameters

A root finding procedure should stop when one of the following conditions is true:

• A root has been found to within the user-specified precision.
• A user-specified maximum number of iterations has been reached.
• An error has occurred.

The handling of these conditions is under user control. The functions below allow the user to test the precision of the current result in several standard ways.

Function: int gsl_root_test_interval (double x_lower, double x_upper, double epsabs, double epsrel)

This function tests for the convergence of the interval [x_lower, x_upper] with absolute error epsabs and relative error epsrel. The test returns `GSL_SUCCESS` if the following condition is achieved,

```|a - b| < epsabs + epsrel min(|a|,|b|)
```

when the interval x = [a,b] does not include the origin. If the interval includes the origin then \min(|a|,|b|) is replaced by zero (which is the minimum value of |x| over the interval). This ensures that the relative error is accurately estimated for roots close to the origin.

This condition on the interval also implies that any estimate of the root r in the interval satisfies the same condition with respect to the true root r^*,

```|r - r^*| < epsabs + epsrel r^*
```

assuming that the true root r^* is contained within the interval.

Function: int gsl_root_test_delta (double x1, double x0, double epsabs, double epsrel)

This function tests for the convergence of the sequence …, x0, x1 with absolute error epsabs and relative error epsrel. The test returns `GSL_SUCCESS` if the following condition is achieved,

```|x_1 - x_0| < epsabs + epsrel |x_1|
```

and returns `GSL_CONTINUE` otherwise.

Function: int gsl_root_test_residual (double f, double epsabs)

This function tests the residual value f against the absolute error bound epsabs. The test returns `GSL_SUCCESS` if the following condition is achieved,

```|f| < epsabs
```

and returns `GSL_CONTINUE` otherwise. This criterion is suitable for situations where the precise location of the root, x, is unimportant provided a value can be found where the residual, |f(x)|, is small enough.

Next: , Previous: Root Finding Iteration, Up: One dimensional Root-Finding   [Index]