Starting from:
$30

$24

NUMERICAL COMPUTATION Homework 11

    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 2 [  1; 1]:

        (a) Using calculus, compute the de nite 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 2 [  1; 1]
where
8
0;
y = 0
sign (y) =




<
1;
y > 0


1;
y < 0

:


How do the observed convergence rates di er from the    rst function? Why do they di er?




























1

More products