Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a computer program which uses the trapezoidal rule to calculate the integr

ID: 3621304 • Letter: W

Question

 

  Write a computer program which uses the trapezoidal rule to calculate the integral of a polynomial function. It should contain a function whose prototype will be:
double integratePoly(int polyOrder, double polyCoef[],double limit_a, double limit_b)

Within this function perform repeated calculations of the integral using the trapezoidal rule, until the difference between two calculations is sufficiently small (0.001). With every new calculation the number of intervals, n, is doubled.

At the top level, main(), the user should be able to direct the program by selecting from a menu of tasks:
1. entry of the polynomial function coefficients,
2. entry of the limits for integration,
3. integration of the polynomial between the entered limits
4. display of the polynomial.
5. display of the result of integrating the polynomial between the entered limits
6. quit the program.

 

SOLUTION:

1. Desk-check your algorithm with the test-case 1: (omit test case 2)

3. Your main should display a menu asking the user to pick from a list of options: enter polynomial coefficients; enter the integration limits; display the polynomial; integrate the polynomial between the entered limits; display the results; or quit. It will be appropriate to use a switch-case branching structure, within a loop, in main() to organize the calling of your functions.

Explanation / Answer

#include #include double h; double f(int ord,double pc[],int p) { double poly=0.0; for(int i=0;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote