Trapezoidal and Simpson rules are methods to approximately calculate a definite integral
Suppose there is a definite integral :
where f(x) is the function, b is the last and a is the first limit of interval [a,b] over which we have to integrate this function.
In trapezoidal rule, we divide the graph into N equally spaced intervals. Like in our case we can divide it into 29 equally spaced intervals. For example, first interval from x = 1 to x = 2, second one from x = 2 to x = 3 and so on.
So by trapezoidal rule : -
where
and f(x0) , f(x1) , f(x2) ... f(xn) are the values of function at x = a , x = a + , x = a + 2 ....x = a + N = b
Thus we have 29 intervals from x = 1 to x = 30
At x = a = 1 , f(x0) = 0.035
At x = a + = 2 , f(x1) = 0.048
.......
At x = a + N = b = 30 , f(xn) = 0.038
Just put all the values in the above equation (1)
Simpson rule : -
Where all the terms have the same meaning as discussed in trapezoidal rule. Simpson rule is a little bit different formula-wise.
NOTE : - Simpson rule only works when, number of intervals (N) in which the curve is divided is EVEN. Thus you can attempt this problem by using Simpson from x = 1 to x = 29 making 28 intervals (EVEN), and then applying trapezoidal from x = 29 to x = 30.
How do I integrate the curve numerically using the trapezoidal rule and integrate the curve numerically using Simposon's...