Instructions for computer part:
• The grader must be able to run one script, or one script for every problem and obtain the desired outcome (graphs, printed values, ect. . . ).
• Please be sure the filename is of the form “last name” then an “underscore” followed through the “problem set number” (and problem number if multiple files).
For illustration Newhall_HW9.m would include all answers generated by one file while Newhall_HW9_2.m would only have problem 2 within the script.
• Be sure to also comprise any files containing functions you have written.
• Please also comprise your last name in subject line.
The written parts must be turned in as usual on paper.
1. (20pts) (written) The backwards Euler different operator is given by
Nhyn = yn − yn−1/ hn − f(tn, yn)
For differential equation y′= f(t, y). Determine the order of the local truncation error. Explain why this diference operator is consistent.
2. (40pts) consider the Van der Pol oscillator
x′′− µ(1 − x2)x′+ x = 0
(a) (Written) Write this equation as a system of first order equations
(b) Taking µ = 2, use MatLab’s routine ode45 to calculate the solution for initial value problem x(0) = 0 and x′(0) = 5 from t = 0 to t = 40. Plot x as a function of t and also plot x vs x′ in phase-space.
(c) Repeat for the initial conditions x(0) = 0 and x′ (0) = 0.01.
(d) (Written) what is the fixed point of the system? Use your numerical results to argue what the long time behavior of the system is.
3. (40pts) Consider the differential equation give by
y′= −10(y − sin t)
(a) (Written) Derive by hand exact solution that satisfies the initial condition
y(0) = 1.
(b) Numerically obtain the solution to the IVP using Forward Euler with a step size of h = 0.1 from t = 0 to t = 3. Print the value of the approximate solution at time t = 3. Also plot the exact solution (with a solid line) and the approximate solution (with square markers) on the same plot.
(c) Numerically determine the relative global error,
eh = |1 − yh(3)/y(3)|
Of your approximate solution at t = 3 when h = h, h/2, h/4, h/8 and h/16.
Plot the log of the relative error vs. the log of the spacing h. (written)
Explain why this verifies your scheme is convergent to order 1.