Search for question
Question

The goal of this assignment is to investigate the rate of convergence of this rule depending on the

functions we want to integrate. To do this, first download from Canvas the MATLAB function

that implements the trapezoidal rule. It has the following inputs: lower and upper bounds of the

interval, number of points in the partition, and the function you want to integrate. To test the

function, compute the integral of the function f(x)=³ over [0, 1] with N = 100 points. What is

the value you get?

Consider the intervals I₁ = [0,] and 1₂ := [0, 2x]. Approximate the integrals over both I₁ and 1₂

of the functions fi(r) = sin(r), f2(2):= |sin(2x)], and fa(z) := cos(x) by using the Trapezoidal

rule. Then plot the absolute error of the computed integral and its corresponding true value. Note

that the true values can be easily computed by hand. Also, find the rate of convergence at which

each error is going to zero. Which one is the fastest? Note that one error plot is always close to

machine epsilon, what do you think is causing this extreme accuracy? This last question is difficult

- you should use an internet search to try and get some information on what is happening and

perhaps why.

Your conclusions should be explained in a one-page report. Your report must include the following:

(a) Output (value of the integral) of your test case f(x) = 2³ on [0, 1] with N = 100 points.

(b) Two loglog plots of the absolute errors, one for I and one for I₂.

(c) Rate of convergence of each error (6 in total). Why is one of the plots around machine epsilon

for almost any values of N?

(d) Make sure you answer all the questions in the document.

Fig: 1