Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

C&EE 103

Applied Numerical Computing and Modeling

Summer 2023

Homework #7

Due at 11:59 pm on Friday, August 18, 2023

Problem 1. Consider the abstract initial value problem

Write a MATLAB script to determine various approximate solutions to this problem based on different nu- merical methods, and give a brief statement on the accuracy and the convergence of each method.  More precisely, do the following:

a)  Verify that the true solution to this problem is given by 

b)  Use hand calculations and the step size h =  1 to determine the approximations y(—2) and y.( — 1)

using the forward Euler method, the backward Euler and trapezoidal methods (with both Newton’s method and the predictor-corrector method), and Heun’s method.  Moreover, use MATLAB  and the tolerance " = 10- 12  to determine the solutions from Newton’s method and the predictor-corrector method.

c)  Use MATLAB to determine the approximations y.x/ at all x-values of interest x e {—2; — 1;0;1;2;3} using the forward Euler method, the backward Euler and trapezoidal methods (with both Newton’s method and the predictor-corrector method), and Heun’s method with all step sizes h  e  {1;0:5; 0:25;0:125}. Furthermore, use the result found in Part a) to compute the exact errors at these points, and observe the ratio by which the error decreases at these points when his halved.  List the values obtained at all x e {—2; — 1;0;1;2;3} in a table, and use MATLAB to graph the true solution Y(x) and the approximations y.x/ for all h e {1;0:125} in the given interval. Use piecewise linear interpolation (MATLAB default) to construct y(x).

d)  Extend the MATLAB script written in Part c) to include a new (explicit) numerical method (to solve initial value problems). To derive the new numerical method, recall that the trapezoidal method can be derived in terms of numerically integrating the right-hand side function f(x,Y(x)) using the trape- zoidal rule.  In HW#4, Problem 3, it was shown how Taylor polynomials can be used to derive a numerical integration scheme. The basic idea of the new numerical method therefore is to use a nu- merical integration scheme based on Taylor polynomials. To be more precise, construct the (at most) linear Taylor polynomial p1.x/ off.x;Y.x// about a = xn in the (arbitrary) subinterval Œxn;xnC1] of length h.  In other words, construct the tangent of f.x;Y.x// at xn, which results in the Taylor polynomial p1(x).  To derive the new numerical method, employ the trapezoidal rule to integrate p1.x/ exactly. This leads to an integration scheme that can be expressed as a weighted sum of func- tion values f and its first-order derivative. Apply the new numerical method to the given initial value problem in the same way as outlined in Part c).

Hint: a MATLAB template will be provided on Bruin Learn.

Turn in your MATLAB script for this problem. Remember to use your name in both the MATLAB filename and the MATLAB script, and upload your MATLAB script to gradescope.