Documente Academic
Documente Profesional
Documente Cultură
Homework 1
Due Thursday, Jan. 22, in class
y(0) = y0
(1)
a) Write a computer program that uses explicit Euler and the trapezoidal rule (Crank-Nicolson
or CN) method to obtain the solution for user-prescribed , y0 and time step. Let = 1
s1 . Vary the time step (t = 0.1, 1, 10, 100 s) and discuss the influence on the solution.
Compare the two methods in terms of accuracy, stability and convergence using your results.
b) Perform a mathematical analysis to obtain the stability and accuracy of the trapezoidal (CN)
method when applied to the linear equation
y 0 = y
c) Analytically obtain the amplitude and phase error of the trapezoidal method with time step
t when applied to Eq. (1)? Is your analysis consistent with the results of varying the time
step in part (a)?
3. A third-order Runge-Kutta scheme (RK3) is used to integrate the following linear ODE;
y 0 = y
y(0) = y0
a) Obtain the stability restriction on the time step t for complex . What is the restriction
on t for real = , > 0.
b) Write a program that integrates Eq. (1) using a RK3 scheme. Use either Eq. (10.37) or
(10.39) from T. Bewleys book as the RK3 scheme. Vary the time step (t = 0.1, 1, 10, 100
s) and contrast with the results of 2 (a).