
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

The parameters α and β allow one to make it very easy or very difficult to integrate. For (a) α = 2, β = 0.2, (b) α = 0.2, β = 2 integrate the equation using the trapezoidal rule, Simpson’s rule, and adaptive quadrature algorithm based on the trapezoidal rule.
a) Compare the number of function evaluations (sub-intervals) required to achieve various tolerances (error). b) Also compare the rates of convergence of the three integration methods, i.e. plot the error vs. number of function evaluations (sub-intervals) in log-log scale.
Assume that the exact integral in the first case is 0.0095499658265276 and in the second case is 0.3457273592825.
In order to evaluate the number of sub-intervals used by adaptive quadrature, the easiest way is to introduce a global variable that is get updated every time the subroutine is called. i.e.
global isub isub=isub+
You can use for the trapezoidal integration and the adaptive quadrature codes that we developed during the class. However, put the comment in the very first line that this is not your code.
P.S. Bring your solution to class. Email your code to [email protected]. The program that you send should be a working program. All the codes will be checked whether they run or not. If they are erroneous, but run, points will be taken for the errors. If the code does not run (it has some syntax errors), an additional 25% will be taken off. The goal of this class is for you to be comfortable solving engineering problems. Please take your time and learn how to trust the computer.