Question: Exercise 1: Implement a C++ program that calculates the left-endpoint, right-endpoint, trapezoidal, midpoint, and simpsons rule approximations for a particular definite integral. The program needs

Exercise 1:

Implement a C++ program that calculates the left-endpoint, right-endpoint, trapezoidal, midpoint, and simpsons rule approximations for a particular definite integral. The program needs to have input n from user using cin and needs to display output on screen using cout. As a test case for our numerical integration, we will approximate the definite integral of f (x) = 1/(1+x^2) on the interval [0, 1].

#include #include using namespace std;

int main() { /* a = lower limit; b = upper limit; n = number of intervals */ int n; cin >> n; cout << << endl; return 0; }

Exercise 2:

Implement a C++ program that automatically finds n for trapezoidal rule to achieve given accuracies? What is the smallest value of n that makes the absolute value of the error in trapezoidal rule less than 106? Less than 108? n needs to be started from 1 with step-size of 1 using loop. Branch needs to be used to find the n which gives error less than 10-6 or 10-8 by stopping there when it meets the condition. The program must use variables, branch, loop in a proper way. The program needs to display detailed procedure and output on screen using cout.

#include #include using namespace std;

int main() { string userName; string totalString; cin >> userName; cout << userName <<"'s code" << endl; // Start your programming here! }

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!