Question: Your program will be used to create a table of data of the independent variable x versus f(x), f'(x) and A . The user will

Your program will be used to create a table of data of the independent variable x versus f(x), f'(x) and A. The user will enter the polynomial coefficients {a,b,c} as well as the starting value of x (denote it xi), the final value of x (denote it xf), and the increment value between successive x values (denote it delta x).

  1. First, read this document in its entirety. After reading this handout, you may optionally create a design sheet for the problem. Your design sheet should help you determine what header files, functions and variables you will need as well as identifying expected test results. You do NOT turn in your design sheet.
  2. When you write your code, include the usual (detailed) comment block including program name, author, date, inputs, outputs, and description.
  3. Create a function of type void to explain the program to the user with the description printed to the terminal. Do not forget to call the function from main().
  4. Input the data while executing from your main() function. Query the user to enter the data. You must enter the parameters from the user in the following order: a, b, c and then xi, xf, and delta x. Use double for all variables and calculations.
  5. Your program is to loop over all possible x values in your main() function. The first x value is to be xi, the second xi + delta x etc. with the last value being xf (or somewhat less than xf if deltaX does not divide evenly into the range).
  6. The calculation of the area A depends on the initial value of x, xi . That is, for each x, we calculate the area as F(x) = F(x) - F(xi) . In order to calculate A, you must know both x and xi. For the first value of x, it should be that A is zero.
  7. From main() and for each x, you are to call a function that accepts a, b, c, x and xi Calculate and return (via pointer operations) f(x), f'(x) and A. That is, you must create a single function that accepts eight inputs five are call-by-value (a,b,c,x,xi) and three are call by reference (pointers for f(x), f'(x) and A). no scan or print statements.
  8. Your function uses the values of a, b and c along with the value of x to compute f(x) = ax2 + bx+ c f'(x) = 2ax +b and with xi compute F(x) = = a/3x3 + b/2x2 + cx and F(xi) = a/3xi3 + b/2xi2 +cxi and finally the area A = F(x) - F(xi). Return the result of your calculations back to the main() function (it will be necessary to reference your outputs via pointers).
  9. All output for your table of x versus f(x),f'(x) and A must be displayed via statements in your main() function. Write your table to the terminal (i.e., the default output for printf()). Choose a suitable format for your output numbers.
  10. Assume that the user enters 2.0 -2.0 -1.0 for a, b, c, respectively, and 0.0 5.0 0.25 for xi, xf and delta x, respectively.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!