Question: Using C++ to solve this proble In this problem, you will be a maximizing cubic polynomial on a user specified interval [a, b]. You will
Using C++ to solve this proble
In this problem, you will be a maximizing cubic polynomial on a user specified interval [a, b]. You will assume that your polynomial has the form f(x) = c3x^3 + c2x^2 + c1x + c0. You will do this by asking the user for the left end point a, the right end point b, the coefficients, c3, c2, c1, c0, and also a grid-size h. Then you should use the following method.
1. Initially set largest = f(a) 2. Check if f(a + h) > f(a). If so, update largest to be f(a + h). 3. Next check f(a + 2h).... 4. Keep going an appropriate number of times 5. After your loop is done, compare f(b) to the largest so far and if needed update largest. (Depending on how you did the previous steps, this the part might be unnecessary, but sometimes the right end-point doesnt get checked because of weird rounding errors.)
At the start of the problem, your program should ask the user for the left end point a and the right end point b. Then it should ask the user to input the coefficients c3, c2, c1 and c0. Then it should ask the user for a grid size.
Example output Left end point: 3 Right end point: 5 Coefficients: 1 2 3 4 Grid size: .01 The largest value of 1*x^3+2*x^2+3*x+4 on [3,5] is 194.
PS: If the user enters the input shown above, the output of your code should match the example output exactly. You are allowed to assume that the user enters a b that is greater than a but your code should work even if a and b are not whole numbers. So for example, the user is allowed to input a = 3.0, b = 3.1, h = .001. Likewise, c0, c1, c2, and c3 are allowed to have decimal parts. If you have taken calculus, you should NOT use knowledge from calculus to solve this problem. Pay attention to the order we put the coefficients in. You should turn in one file for this program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
