Polynomial representation using array program

broken image
broken image

That is, they all have the same upper limit on the degree. This class has the limitation that all Polynomials have the same 'physical size'. It can represent a polynomial of any degree up to and including MAX_DEGREE (a global constant defined with the class).

broken image

(similar to the List class in section 6.2 of your textbook). A polynomial of degree n has n + 1 coefficients.Īn array of size k can hold the coefficients for a polynomial of degree k - 1 (or a smaller degree).īelow you will find code for a Polynomial class that uses an array to hold the polynomial coefficients One way to represent a polynomial is to use an array to hold the coefficients. Note that a polynomial with degree 2 is called a quadratic polynomial.

broken image

Note that x 1 is the same as x, and x 0 is 1.Ī polynomial whose coefficients are all zero has degree -1. The highest exponent with non-zero coefficient, n, is called the degree of the polynomial.Ġx 2 + 2x + 3 is normally written as 2x + 3 and has degree 1. , a 2, a 1, and a 0 are constants called the coefficients of the polynomial. Where x is a variable that can take on different numeric valuesĪnd a n. I will not make any changes unless I find problems.īe sure to read through Section 6.3 in your textbook before starting this assignment.Ī polynomial in one variable is an arithmetic expression of the form Program 2 - Polynomial Class with a Dynamic Arrayįinal version.

broken image