Roots of Polynomial
Write a program to find all real roots of a given polynomial f. Starting with 0.0, use step size of 0.25 to find a and b such that sign(f(a)) <> sign(f(b)). Run the false position method for 3 iterations, then change to the Newton's method, using the middle point of a and b as the starting point, until |f(Xn)| |Xn - Xn-1|/|Xn-1|
Divide out Xn, using the synthetic division, and repeat the process until the degree of polynomial is reduced to 2. Use the quadratic equation to find the last two roots.
Print out all roots and number of iterations in Newton's method.
input file name: Root.dat
input file format:
LINE 1: N 1 intger, the degree of polynomial
LINE 2: An An-1 An-2 ........A1 A0n+1 floats separated by one space, coefficients of polynomial
Output: (to terminal)
all real roots in scientific notation.
number of iterations in Newton's method.