How to iteratively solve a polynomial equation.


While programs like MAPLE or Mathematica are great and should be on every computer, spreadsheet programs can also help us find the roots of very compilcated polynomial equations. While equations do exist for quadratic, cubic, and quartic equations, they do become significantly more complex with increasing powers of x and four powers higher than 4, no solutions are known. But a solution does exist and can be found in all cases with an iterative solution.

Consider the equation 5x4 - 10x3-14x2 + 10x - 17 = 0. Rewrite the equation so that the largest power of the variable is isolated on the left side of the equation.

5x4 = 10x3+14x2 - 10x + 17

Divide through the coefficient of the term and take nth root of the entire equation. This should give you and expression x = ....

x = ((10/5)x3+(14/5)x2 - (10/5)x + 17/5)1/4 = (2x3+2.8x2 - 2x + 3.4)1/4

The task is to find the value of x which makes the two sides equal to each other. Clearly, if we found a value of x which, when place into the complicated polynomial expression on the right, produced a result which was the same number as we put in, then the equation would be x = x and we would have found a root of the original equation. Clearly there are 4 roots. Some of them may be complex. If they are complex, they always occur in pairs. For physically significant problems, we are only interested in real roots. Furthermore, there will always be other restrictions in the problem which will allow us to reject all the other real roots except the one which makes physical sense.


Procedure:

Go to your spreadsheet program. In the first cell (A1) you must enter your first GUESS at the root. Usually from the problem you know that it must be 3 or 1000 or something like that. For the problem 10 on Quiz 2 of the Web Quizzes, we know that the root of that equation must be less than 1.5, otherwise some terms of partial pressure would be negative, which is physical meaningless. In such a case, a guess of 1 would be a good starting point. If you don't have a good idea, start with 1. If the procedure doesn't converge (see below), stop and take another guess until you find a stable region of the function's domain.

In the cell B1, enter the equation you have derived, using the cell A1 for the value for x.

= (2(A1)3+2.8(A1)2 - 2(A1) + 3.4)1/4

Cell B1 then contains your next guess at the root.

Go to cell A2 and reference cell B1; enter your next guess there.

= B1

Go to cell B2 and copy down the equation from B1, making sure that your spreadsheet correctly changes the relative references so that x is now from A2. It should do this automatically for you.

= (2(A2)3+2.8(A2)2 - 2(A2) + 3.4)1/4

This is now your third guess. Copy both columns down as far as you want. Each row should get progressively closer in value to the previous row. When this happens, your process is converging and you can stop as soon as you have as many significant figures as you want; that is when the previous row is the same as the current row to the correct number of sig figs.

Note on convergence: If your guess is in the region of the domain of the function which doesn't have a root nearby, the procedure can diverge to infinity. This simply means you chose to look for a root in a region where there isn't one. Try again. Also, depending upon the slope of the function in this region, the convergence can be very slow. You made need to go to several hundred iterations to get satisfactory results. But on your spreadsheet, that simply means copying the function down further and further. It is not uncommon to go to several hundred iterations or more if you want 4 or 5 decimal place accuracy. Also, when convergence is slow, you may not have as many sig figs as you think you do. If guess 7 is for a value of 2.45 and guess 8 is for 2.48, it doesn't mean the answer is 2.4 to 2 sig figs. Further iterations may slowly climb to 2.8 or 2.9. Run you process through many iterations to make sure it is converging on the number you think. But again, with a spreadsheet this is easy to do - just copy down some more.

Note: The function above finds a root equal to 2.87501713 after 54 iterations. It took me less than 1 minute to enter the function and solve this problem to this precision.

Further note: 3 more roots exist. If you need to find other ones, make other guesses; if they don't converge to the same root, then it is a new one. It would take some more complex (pun intended) calculations to find the imaginary roots. The nice thing about this procedure is that it is extendable to a polynomial of any order.


Click here to go back to the IPS*1200 Course Home Page or use the back button to return from where you came.

Last update: 19 Jan. 1999
Comments to: Dan Thomas