Polynomial Root finding bisection

2.3k Views Asked by At

If I am finding the roots of a polynomial using the bisection method, and in some cases depending on the polynomial the roots might be negative or they may be positive.

I understand I can determine if the roots are going to be negative or positive, based on the result of evaluating the polynomial... however I am unsure what I would use as x.

Can anyone give any insight here?

4

There are 4 best solutions below

1
On

The fact that the roots can be negative or positive has nothing to do with the bisection method. The existence of a root can be proved using the intermediate value theorem from calculus.

So all you have to do is find points x1 and x2 such that y(x1) is negative and y(x2) is positive. Then you know from the IVT that there is a root between x1 and x2. You do that by doing a binary search on that interval. If y(x3) = y((x1+x2)/2) is negative, then you repeat the bisection search on the interval [x3,x2]. Otherwise if it's positive, then search on the interval [x1,x3].

It doesn't matter whether the root is negative or positive. I'm not sure if that answers your question, but I hope that helps you understand the algorithm.

0
On

Many root-finders allow the user to supply a starting point or points to begin searches. This allows users to try to "fiddle" the results to find different roots or allow the finder to converge to a root.

If it does not make sense to allow a user to provide starting values you could begin by probing a handful of points:

  • -1, 0, 1
  • -10, 0, 10
  • -100, 0, 100
  • etc.

If the input is an odd polynomial, this will eventually discover a suitable range for bisection. If the input is an even polynomial, you might never catch sign changes (consider f(x)=x^2 -- it is never negative), so be prepared to give up after a certain (configurable?) amount of probing.

I've suggested making the ranges larger by powers of 10 here; since the bisection approach cuts the range in half each time, perhaps this is too conservative. (It'll take between two and three iterations of the bisection to reduce a range to the next "tighter" bracket.) Maybe better would be larger jumps:

  • -10, 0, 1
  • -1000, 0, 1000
  • -100000, 0, 100000
  • etc.

This will perform fewer probes but require more bisection. Try a handful of polynomials and track execution time for finding the roots with both suggestions.

3
On

You would probably find this helpful.

using System;

namespace Bisection_Method

{

class Program

{

    public double midPoint (double xl, double xu)

{

    return (xl + xu) / 2;

}

    public double function(double x)

    {

        return (x*x-2);

    }

    static void Main(string[] args)

    {

        Program root = new Program();

        double xm=0, xl=1, xu=2, check=0;

        for (int x = 0; x < 20; x++)

        {

            xm = (xl + xu) / 2;

            check = root.function(xl) * root.function(xm);

            if (check < 0)

                xu = xm;

            else if (check > 0)

                xl = xm;

            else if (check == 0)

            {

                break;

            }

        }

        Console.WriteLine("The Approximate of the Root is {0}", xm);

    }

}

}

http://mustafa.amnbytes.com/2012/09/bisection-method-program-in-c.html

0
On

In order to use the bisection algorithm, you first need to find an interval which contains a root. The standard algorithm for this is given in Sturm's Theorem.

However the standard bisection algorithm expects the signs of the function values in the endpoints to be different. This can be problem. The simplest example is x^2 which has the single root 0 of order 2. Since x^2 is positive for all non-zero x, you can not find an interval enclosing the root suitable for use with the bisection algorithm.