Project 2: Multiplying Polynomials

The length of this rectangle is expressed as 2x + 5.  The width is expressed as x + 8.

The area of the rectangle can be expressed as (2x + 5)(x + 8) = 2x^2 + 21x + 40

Explanation:

When X = 1, the length is 2*1 + 5 = 7

When X = 1, the width is 1 + 8 = 9

When X = 1, the area is 7*9 = 63

When X = 1, the area is 2(1)^2 + 21(1) + 40 = 2 + 21 + 40 = 63


When X = 2, the length is 2*2 + 5 = 9

When X = 2, the width is 2 + 8 = 10

When X = 2, the area is 9*10 = 90

When X = 2, the area is 2(2)^2 + 21(2) + 40 = 8 + 42 + 40 = 90

Difficulty Level: High

Project 2: Variables 'co' and 'co2' have been initialized.   These arrays represent the coefficients of two polynomials with the coefficients of the lowest power listed first as shown in the example above.

Task: To correctly assign the values of 'prod' (which already exists) to correspond to the product of the polynomials with coefficients 'co' and 'co2'.

How to add to an array in JavaScript:

x.push(3);

x.push(5);

x.push(4 + 4);

//x would store the array [3,5,8].  The push command adds the value to the end of the array.

Note: If coding in Java, you can assume that 'sum' has been declared and initialized as an empty ArrayList.

**If your code works for 5 test cases in a row, you can enter your e-mail address.

Universal Computational Math Methods:

pow(5,2) returns 25.0

abs(-3.0) returns 3

sqrt(49.0) returns 7.0