Purpose: To perform synthetic division on a polynomial. The program utilizes the "For" loop and lists.
Consider the algorithm for synthetic division as it is performed on paper. We have a binomial x-r. The constant r is written to the side. They the coefficients are listed to the right, beginning with the highest degree term and proceeding to the lowest. If a term of a certain degree is missing, 0 is entered as the coefficient. For example, let's divide m-3 into
has no x cubed term, so the list would be 2, -5, 0, -10, 8. The first coefficient is always brought down.
3 | 2 | -5 | 0 | -10 | 8 |
2 |
The product of the constant r =3 and the fourth power coefficient goes underneath the third power coefficient. Then the sum of the third power coefficient and the product is entered below.
3 | 2 | -5 | 0 | -10 | 8 |
6 | |||||
2 | 1 |
This process is repeated until the bottom row is complete. Multiply r = 3 by the calculated sum and enter under the second power coefficient. Compute the sum again, and so on.
3 | 2 | -5 | 0 | -10 | 8 |
6 | 3 | 9 | -3 | ||
2 | 1 | 3 | -1 | 5 |
If r is a root of the polynomial the last entry would be a zero signifying no remainder. The last row is now the coefficients of the quotient.
We can program this algorithm with the use of lists. This first step is to prompt the user for the root to be divided, constant R. The calculator must also know the degree of the polynomial, N. The degree is used to increment inside a "For" loop since the "dividing" occurs that many times. Display messages to inform the user which variable is which.
Use the "ClrList" command to delete any values that may be in List 1 and List 2. The "ClrList" command is found inside the "STAT" menu (2nd row, 3rd column). The variables for List 1 (L1) and List 2 (L2) are activated by pressing the "2nd" key followed by the numbers 1 and 2 respectively.
Prompt the user to enter the coefficients. How many coefficients will there be? Use this to write a "For" loop prompting the use that many times. Save each coefficient as an entry in List 1. Entries are designated by the List followed by the row number in parentheses. To see the for loop, click here.
Then store the value from list 1's first entry to list 2's first entry. What step does this command model if we were doing this by hand?
Now we can use another For loop to perform the multiplication by r followed by the addition. How many times will this loop increment? Why is it different from the loop before? Click here to find out.
The whole list can be diplayed using the "Disp" command and the variable L2. The process is performed one last time and displayed as the remainder. Why is it wise to do a separate calculation for the remainder? What does it mean when the remainder is zero?