CSCI3656: NUMERICAL COMPUTATION Homework 11 solution

$35.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

1. Implement the following numerical methods for approximating integrals: (i) trapezoidal rule, (ii)
Simpson’s rule, and (iii) Clenshaw-Curtis rule. Code for generating the points and weights of the
Clenshaw-Curtis rule is available on Canvas.
Consider the function
f(x) = sin(2 x) + cos(3 x), x ∈ [−1, 1].
(a) Using calculus, compute the definite integral of f(x) on the interval [−1, 1].
(b) For n = 2k + 1 with k = 1, . . . , 20, use the three numerical integration methods to estimate
the integral with n points. Plot the relative error as a function of n on a log-log scale.
(c) Identify the values of n that constitute the asymptotic regime. For each of the three methods,
what convergence rate do you observe?
2. Repeat the previous numerical study for the function
f(x) = sign (x − 0.2) + 1, x ∈ [−1, 1]
where
sign (y) =



1, y > 0
0, y = 0
−1, y < 0
How do the observed convergence rates differ from the first function? Why do they differ?
1