Question: python program which can: 1) Understand a string of polynomial forms and change to the array. 2) Addition, subtraction, Multiplication of polynomials with one variable
python program which can: 1) Understand a string of polynomial forms and change to the array. 2) Addition, subtraction, Multiplication of polynomials with one variable x. 3) Evaluate the value of f(a) for a given value a.
The Program must have: a class name Polynomial, and write addition, subtraction, Multiplication and evaluate method inside class.
The class should also include __init__ and __str__ method.
Sample output:
polynomial calculator >>>Type a for addition >>>Type s for subtraction >>>Type m for multiplication >>>Type e for evaluation >>>Type command: a #(a is user input)
Second, type two polynomials. Then return the their sum. >>>Type first polynomial: x^2 - 2x + 3 >>>Type second polynomial: x^2 + 3x + 1 >>>Their sum is x + 4 Ask command again until user types q.
polynomial calculator >>>Type a for addition >>>Type s for subtraction >>>Type m for multiplication >>>Type e for evaluation >>>Type your command: e #(e is user input)
Type first polynomial: -x^2 + 1 >>>Choose value of x to evaluate: -1 >>>The value of your polynomial at x = -1 is 0
include the screenshot of the program and the output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
