Assignment 3
1. (20 points) Compute y(0.1), y(0.2), y(0.3) for the IVP: ẏ = t− y2, y(0) = 1,
Copyright By PowCoder代写 加微信 powcoder
(1) Write a code to conduct the computation using forward Euler’s method with step-size
h = 0.1, 0.05, 0.0025.
(2) Write a code to conduct the computation using the fourth order Runge-Kutta method
with step-size h = 0.1, 0.05, 0.0025.
2. (30 points) Consider the initial value problem y′(t) = f(y(t), t) for all t ∈ [0, T ] with y(0) = a.
Partition the time interval [0, T ] into N equal pieces with step size h = T/N and grid points
ti = ih. Assume that f(·, ·) is a smooth function.
(a) Consider the implicit Euler’s method
Y n − Y n−1
= f(Y n, tn), for all n = 1, 2, . . . , N with Y
Show that the local truncation error is O(h).
(b) Find A1, A2 and A3 such that local truncation error of the finite difference scheme
= f(Y n, tn), for all n = 2, 3, . . . , N
is O(h2) by using Taylor’s expansion.
(c) Let’s revisit the implicit Euler’s method in (1). Note that in each time step, we need to
solve a nonlinear equation
Y n = Y n−1 + hf(Y n, tn). (1)
Assume that |fy(y, t)| ≤ L with a positive constant L for all y ∈ R and t ∈ [0,∞). Find the
condition on step size h such that there exist a unique Y n solving the nonlinear equation
(d) Under the derived condition in part (c), write down the formula of Newton’s method to
solve the equation (1).
3. (10 points) Consider the two-point boundary value problem
−u′′ + u = 2x in (0, 1), with u(0) = u(1) = 0.
Write a code to apply the central finite difference method with h = 1/10, 1/20, 1/40. Compute
the error in `∞ norm.
4. (20 points) Develop a second-order finite difference scheme for the two-point boundary value
−u′′ = sin(πx) in (0, 1), with u(0) = 0, u′(1) = 1.
(1) Construct the linear system.
(2) Write a code to examine the second-order convergence by presenting the `∞ error for
h = 1/10, 1/20, 1/40.
5. (20 points) Consider the initial-boundary value problem
ut − uxx + u = 0, in Ω = (0, 1), t > 0, (PDE).
u′(0, t) = u′(1, t) = 0, for t > 0 (Boundary condition).
u(x, 0) = cos(πx), in Ω = (0, 1) (Initial condition).
The exact solution is u(x, t) = e−(π
2+1)t cos(πx).
• Develop a finite difference scheme with error O(k + h2).
• Write a code to examine the second-order convergence by presenting the `∞ error for
(k, h) = (1/10, 1/40), (1/40, 1/80), (1/160, 1/160).
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com