This repository was archived by the owner on May 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPFMexample.py
25 lines (24 loc) · 1.89 KB
/
PFMexample.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Example:
def __init__(self):
print("You have choosen to view an example. To advance each step press enter.\nIn the example we will use the polynomial: 2x^4 + x^3 - 19x^2 -9x +9\n\n")
input("")
print("First you will find the factors of the leading coefficient: q = +-1, +-2")
input("")
print("Then you will need the factors of the trailing constansep=' 't term: p = +-1, +-3, +-9")
input("")
print("You will then need to list the possible zeroes by taking p and dividing by q: +-1/1, +-1/2, +-3/1, +-3/2, +-9/1, +-9/2")
print("These can be reduced to: +-1, +-1/2, +-3, +-3/2, +-9, +-9/2")
input("")
print("When you have the set of all possible zeroes from the polynomial you can then use synthetic division to test for each:\n")
print("1 | 2 1 -19 -9 9\n | 2 3 -16 -25\n --------------------\n 2 3 -16 -25 -16\n\nThe remainder is not a 0 therefore 1 is not a root.")
input("")
print("-1 | 2 1 -19 -9 9\n | -2 1 18 -9\n -------------------\n 2 -1 -18 9 0\n\nThe remainder is a 0 therefore -1 is a root.")
input("")
print("1/2 | 2 1 -19 -9 9\n | 1 1 -9 -9\n ------------------\n 2 2 -18 -18 0\n\nThe remainder is a 0 therefore 1/2 is a root.")
input("")
print("-1/2 | 2 1 -19 -9 9\n | -1 0 19/2 -1/4\n ------------------------\n 2 0 -19 1/2 35/4\n\nThe remainder is not a 0 therefore -1/2 is not a root.")
input("")
print("3 | 2 1 -19 -9 9\n | 6 21 6 -9\n --------------------\n 2 7 2 -3 0\n\nThe remainder is a 0 therefore 3 is a root.")
input("")
print("-3 | 2 1 -19 -9 9\n | -6 15 12 -9\n ------------------------\n 2 -5 -4 3 0\n\nThe remainder is a 0 therefore -3 is a root.")
input("")