The bisection method for finding the minimum starts with an interval that contains the minimum and then divides that
interval into two parts to zoom in on the minimum location.
Algorithm Creation
The steps to apply the bisection method to find the minimum of the function f(x) are listed below,
Choose xa and xb as two guesses for the minimum such that
f'(xa)f'(xb) < 0
Set xm = x(a + xb) / 2 as the mid point between xa
and xb.
Repeat the above steps until the specified accuracy is reached.
|
Testing the Bisection Method
We use the bisection method to find the minimum of a nonlinear function. To test it out as defined above, a new TestBisection()
static method has been added and executed. Supporting code and methods are not shown.
static void TestBisection();
{
ListBox1.Items.Clear();
ListBox2.Items.Clear();
double result = Optimization.Bisection(f, t1, t2, 1.0e-5);
ListBox1.Items.Add("x = " + result.ToString());
ListBox2.Items.Add("f(x) = " + f(result).ToString());
}
|