0% found this document useful (0 votes)
11 views2 pages

Euler's Method for Differential Equations

The document outlines the application of Euler's Method to solve three different differential equations with specified initial conditions and step sizes. The results include approximations for y values at given x points for each equation. The calculations are presented in tabular format, showing the iteration index, x values, and corresponding y values.

Uploaded by

elbomartoljan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Euler's Method for Differential Equations

The document outlines the application of Euler's Method to solve three different differential equations with specified initial conditions and step sizes. The results include approximations for y values at given x points for each equation. The calculations are presented in tabular format, showing the iteration index, x values, and corresponding y values.

Uploaded by

elbomartoljan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Euler's Method

1) Solve the following differential equation using Euler' s Method with step size h =
0.5 for values of x in the range [0, 1]
dy/dx = x + y ; y (0) = 2.
In[22]:= x[0] = 0; y[0] = 2; n = 2; h = 0.5;
f[x_ , y _] := x + y;
list = "i", "x", "y", {0, x[0], y[0]};
Fori = 1, i ≤ n, i ++, x[i] = x[i - 1] + h;
y[i] = y[i - 1] + h * f[x[i - 1], y[i - 1]];
values = i, x[i], y[i];
AppendTo[list, values]
Grid[list, Dividers → All]

Out[26]=

i x y
0 0 2
1 0.5 3.
2 1. 4.75

2) Using Euler' s method, approximate


dy/dx = x + 2 y ; y (0) = 0.
Take step size as 0.1. Find y(0.4)
In[27]:= x[0] = 0; y[0] = 0; n = 4; h = 0.1;
f[x_ , y _] := x + 2 y;
list = "i", "x", "y", {0, x[0], y[0]};
Fori = 1, i ≤ n, i ++, x[i] = x[i - 1] + h;
y[i] = y[i - 1] + h * f[x[i - 1], y[i - 1]];
values = i, x[i], y[i];
AppendTo[list, values]
Grid[list, Dividers → All]
Out[31]=

i x y
0 0 0
1 0.1 0.
2 0.2 0.01
3 0.3 0.032
4 0.4 0.0684
2

3) Using Euler' s method, approximate


dy/dx + 0.5 y = 4 exp(0.8 x) ; y (0) = 2.
Take step size as 1. Find y (4)
In[32]:= x[0] = 0; y[0] = 2; n = 4; h = 1;
f[x_ , y _] := 4 Exp0.8 x - 0.5 y;
list = "i", "x", "y", {0, x[0], y[0]};
Fori = 1, i ≤ n, i ++, x[i] = x[i - 1] + h;
y[i] = y[i - 1] + h * f[x[i - 1], y[i - 1]];
values = i, x[i], y[i];
AppendTo[list, values]
Grid[list, Dividers → All]
Out[36]=
i x y
0 0 2
1 1 5.
2 2 11.4022
3 3 25.5132
4 4 56.8493

You might also like