Question 7.15: STABILITY OF EULER’S METHODS y’ = −4y, y(0) = 2, 0≤x≤5 1. S...
STABILITY OF EULER’S METHODS
Consider the initial-value problem
y’ = −4y, y(0) = 2, 0≤x≤5
1. Solve using Euler’s method with step size h = 0.3 and again with h = 0.55, plot the estimated solutions together with the exact solution y(x) = 2e^{-4x} , and discuss stability.
2. Repeat using the Euler’s implicit method, Equation 7.54.
y_{i+1}=y_i+hf(x_{i+1},y_{i+1}), i=0,1,2, \cdot \cdot \cdot ,n-1 (7.54)
Learn more on how do we answer questions.
1. Comparing the IVP at hand with the model in Equation 7.50, we have λ = 4. The stability criterion for Euler’s method is
y’ = −λy, y(0) = y_0, λ= const > 0 (7.50)
4h<2 ⇒ h<\frac{1}{2}Therefore, Euler’s method is stable if h < 0.5, and is unstable otherwise. As observed from the first plot in Figure 7.7, Euler’s method with h = 0.3 < 0.5 produces estimates that closely follow the exact solution, while those generated by h = 0.55 > 0.5 grow larger in each step, indicating instability of the method.

2. As mentioned earlier, when applied to a simple IVP such as the one here, Euler’s implicit method is stable for all step sizes. The second plot in Figure 7.7 clearly shows that the errors associated with both step sizes decay to zero as x increases, indicating stability. The following MATLAB script completely generates the results illustrated in Figure 7.7.
y0 = 2; f = @(x,y)(−4*y);
yExact = matlabFunction(dsolve('Dy+4*y=0','y(0)=2','x')); % Exact solution
h1 = 0.3; x1 = 0:h1:5; h2 = 0.55; x2 = 0:h2:5;
% Euler's method with h = 0.3 and h = 0.55
y1 = EulerODE(f,x1,y0); y2 = EulerODE(f,x2,y0);
y1I(1) = y0;
for i = 2:length(x1),
y1I(i) = y1I(i−1)/(1+4*h1); % Implicit Euler with h = 0.3
end
y2I(1) = y0;
for i = 2:length(x2),
y2I(i) = y2I(i−1)/(1+4*h2); % Implicit Euler with h = 0.55
end
x3 = linspace(0,5);
ye = zeros(100,1);
for i = 1:100,
ye(i) = yExact(x3(i));
end
subplot (1,2,1), plot(x1,y1,'o',x2,y2,'+',x3,ye,'-') % Figure 7.7
title('Euler')
subplot (1,2,2), plot(x1,y1I,'o',x2,y2I,'+',x3,ye,'-')
title('Euler implicit')