Example 1. Find the minimum of the unimodal function    on the interval  .

Solution 1.

``````

``````

```

```

Solution by solving

A root-finding method can be used to determine where the derivative
is zero.

Since
and    have opposite signs, by the intermediate value theorem a root of lies in the interval  .  The results obtained by using the secant method with the initial values    and    are given by the following computations.

``````

``````

The conclusion from applying the secant method is that

The second derivative is
and we compute

Hence, by the
second derivative test, the local minimum of    on the interval is

Solution using the golden ratio search for the minimum of

Let
and  , and start with the initial interval  .   Formulas (1) and (2) yield

``````

``````

Since  , the new subinterval is  .
To continue the iteration we set
, , , and compute .

``````

```

```

Now compute and compare and to determine the new subinterval and continue the iteration process.  The list of computations are obtained by using the GoldenSearch subroutine are:

``````

```

```

At the twenty-fifth iteration the interval has been narrowed down to

.

This interval has width  .

However, the computed function values at the endpoints agree to ten decimal places

hence the algorithm is terminated. A difficulty in using search methods is that the function may be "flat" near the minimum, and this limits the accuracy that can be obtained.  The secant method was able to find the more accurate answer

and

Although the golden ratio search is the slower in this example, it has desirable feature that it can be applied in cases where is not differentiable.

Let us compare these answers with Mathematica's subroutine FindMinimum.

``````

```

```

This is close to the values obtained with the golden ratio search.  If more decimal places are needed, we can print them out.

``````

```
```

However, they are not as accurate as those computed with the secant method applied to solving  .

(c) John H. Mathews 2004