Bairstow method for polynomial factorization

Consider the problem of finding the roots of a polynomial $P$. When the roots of $P$ are real, the Newton-Raphson method can be applied to find the roots. Nevertheless, this method is unable to find the complex roots of $P$. The Bairstow method is a method computing the irreducible factors of degree $2$ of a real polynomial. Incidentally, it avoids the computations with complex numbers. Technically, it simply consists in applying the Newton-Raphson method to a specific function.

The Bairstow algorithm is described in the Numerical Recipes available at this location (chap. 9.5.6). First, read this section before doing anything further.

  • Questions :
    1. Describe (literally) the function whose zero is computed in dimension 2. In particular, define its domain of definition and its range, and explain the role of the variables $B$, $C$ and $S$. What are the zeroes of this function ?

    2. Write the code of this function by reusing the function numpy.polydiv (which computes simultaneously the quotient and the remainder of the division). In order to test this function, it suffices to construct the adequate polynomial of the form $Q(X)*(X^2+BX+C)+RX+S$ and to apply the function.

    3. In the Numerical Recipes, find the 4 partial derivatives of the previous function in the section mentionned above. Write the equations defining these derivatives, and program them.

    4. Write the Bairstow algorithm, and test it using a method of your choice.