Euler's Method for Second Order Differential Equation

Euler's Method for Second Order Differential Equation
$\begingroup$

Not really homework but sample exam.

The question is to use Euler's Method to approximate Y:

$Y''(t) = Y'(t) - 2Y(t)$
$Y'(0) = Y(0) = 1$

with $t_0 = 0$ and $h=0.2$


So what I did:

First iteration:
$t_1 = 0.2$
$y(t_1) = y(t_0)+h \cdot y'(t_0) = 1 + 0.2 \times 1 = 1.2$
$y'(t_1) = y'(t_0) + h \cdot (y'(t_0) - 2y(t_0)) = 1 + 0.2 \times (1-2\times1) = 0.8$

Second iteration:
$t_2 = 0.4$
$y(t_2) = y(t_1)+h \cdot y'(t_1) = 1.2 + 0.2 \times 0.8 = 1.36$
$y'(t_2) = y'(t_1) + h \cdot (y'(t_1) - 2y(t_1)) = 0.8 + 0.2 \times (0.8-2\times1.2) = -2.4$

Correct?

$\endgroup$

2 Answers

$\begingroup$

There is an arithmetical mistake at the very last step. I get $y'(t_2)=0.48$.

Such problems are easy to code in a spreadsheet.

A     B       C
0     1       1
0.2   1.2     0.8
0.4   1.36    0.48
0.6   1.456   0.032

Here A is for $t$, B is for $y(t)$, and C is for $y'(t)$. The top row are initial values A1=0, B1=1, C1=1. The second row is the Euler step: A2=A1+0.2 , B2=B1+0.2*C1, C2=C1+0.2*(C1-2*B1). Then drag down for as many rows as you wish.

If for some odd reason you can't use spreadsheet software during an exam, at least it gives a way to check your hand computations.

$\endgroup$
$\begingroup$

I realize this is very old. I think you would first have to transform your second order ODE into two first order ODE's, then proceed to apply Euler's method to both equations simultaneously.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.