When you have an analytical expression for an integrand y(x) but you cannot perform the integration from
Question:
When you have an analytical expression for an integrand y(x) but you cannot perform the integration from x = a to x = b analytically, the procedure is to evaluate y at a series of values of x from a to b, i.e. to generate a data table—and then to use a quadrature formula such as Simpson’s rule to estimate the integral. Now, however, you have the choice of the number of evaluations of y(x) to make. As a rule, the accuracy of a quadrature formula increases with the number of points in the interval of integration, but so does the required computation time. Choosing the number of points to provide a suitable combination of accuracy and low computation time can be done using sophisticated numerical analysis techniques, but simple trial and error often suffices very well. A common procedure is to evaluate the integral using (say) 9 points, then 17, then 33, and so on (nnew = 2nold - 1), until successively calculated values agree within a specified tolerance. 2 The last value should be a good approximation to the exact value of the integral. Suppose ( ) .
a. Set up an MS Excel spreadsheet to evaluate ∫ ( ) : 1. Analytically. 2. Using the trapezoidal rule, with points at 0, 1, 2, 3, 4. 3. Using Simpson’s rule, with points at 0, 1, 2, 3, 4. In all three cases, plot I i.e. the integral of f(x) vs. x. [18]
b. Explain the relationship between the answers to 1 and 3.