Question: For this project, you must first implement the Polynomial class from the Chapter 3 Programming Project 8 on page 170. Add a new method to
For this project, you must first implement the Polynomial class from the Chapter 3 Programming Project 8 on page 170. Add a new method to the class with four parameters: a polynomial f and three double numbers x, z, and epsilon. The precondition requires that epsilon is positive and f(x) <= 0 <= f(z).
The method searches for a number y between x and z, where f(y) is zero. Such a number is called a root of the polynomial. The method’s return value might not be an exact root, but the difference between the return value and a real root should be no more than epsilon. The algorithm is a binary search of the numbers between x and z.
Data from Project 8
A one-variable polynomial is an arithmetic expression of the form:
a0 + a1x + a2x2 + … akxk
Implement the polynomial class described in Section 3.4.
Step by Step Solution
3.42 Rating (171 Votes )
There are 3 Steps involved in it
class Polynomial private double coefficients public Polynomialdouble coefficients thiscoefficients ... View full answer
Get step-by-step solutions from verified subject matter experts
