Description
In this assignment, you will implement the following numerical integration methods:
- Trapezoidal rule
- Simpson’s 1/3 rule
- Simpson’s 3/8 rule
Input file specifications
The input file will start with N, an integer, indicating how many data points are there. Next follows 2*N floating point numbers. The first floating point number indicates value of x, the second indicates f(x). x and f(x) both can be negative. A sample input file is:
10
0 0
1.5 6.2
…
…
11.8 20
Therefore, from input, you know x’s and f(x)’s. You have to determine the following integral using numerical integration methods stated before.
The x’s in the input file will be sorted from minimum to maximum.
Output requirements
You can write the output in file or in console. First, you should output the following:
Trapezoidal rule: x intervals
1/3 rule: y intervals
3/8 rule: z intervals
Here, x denotes the number of intervals that were integrated using Trapeziodal rule and so on. (You should readily see why x, y and z should sum to N-1.)
Next, you should print the value of the integral.
Plotting
Your program should also generate a graph where the data points are shown. The intervals should be annotated properly to show in which of the three methods you integrated that interval. (There should be x intervals annotated with Trapezoid, y intervals with 1/3 rule and z intervals with 3/8 rule).
Plagiarism and surfing the Internet
Be cautious when copying someone’s code, even if it is not your batch-mate. Plagiarism means taking credit for something without doing it yourself, which includes copying Internet code as well. If you copy something from the Internet and or from someone else, you will be convicted of copying and will be penalized a negative 100% marks. Usually these copy checks are made at the end of the term. If you are feeling happy that you escaped copy-check is Assignments 2 and 3, don’t fool yourself. Copy check will be made and you will get caught.



