Project 23: Draw Polynomials
Project 23: The following variables (xMin, xMax, yMin, yMax, co) have been initialized. There are also working methods called getYPoly and drawPoint available.
xMin is the lowest x-value on the graph (-5 for the example below)
xMax is the highest x-value on the graph (6 for the example below)
yMin is the lowest y-value on the graph (-5 for the example below)
yMax is the highest y-value on the graph (3 for the example below)
co is an array of values that represent the polynomial's coefficients in ascending order
example: the polynomial graphed below is y = x^3 - 4x^2 - 11x + 30
The array 'co' would hold values: {30, -11, -4, 1}.
getYPoly is a method that accepts an array of coefficients (representing the coefficients of a polynomial) and an x-value. The method returns the y-value for the polynomial at the given x.
drawPoint(x,y) draws a point on the graph at (x,y)
example 1: co = {30, -11, -4, 1}. getYPoly(co, 2.0) returns 0.0
example 2: co = {30, -11, -4, 1}. getYPoly(co, 0.0) returns -2.0
Task: Implement (write code) to draw the polynomial 'co' on the graph. Your graph will be presented in MAGENTA.
Universal Computational Math Methods:
pow(5,2) returns 25.0
abs(-3.0) returns 3
sqrt(49.0) returns 7.0