0% found this document useful (0 votes)
486 views

Euler's Method:Method of Solving Differential Equations of The First Order (The Easy Ones)

Euler's method is used to solve first order differential equations. It works by approximating the slope of the true solution at discrete time steps, marching forward to iteratively calculate predicted values. In this example, Euler's method is used to solve a differential equation modeling the cooling of a hot ball. The temperature is calculated at 480 seconds using a step size of 240 seconds, and the numerical solution is compared to the exact solution to analyze the effect of step size in Euler's method.

Uploaded by

Ahmed Hassan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
486 views

Euler's Method:Method of Solving Differential Equations of The First Order (The Easy Ones)

Euler's method is used to solve first order differential equations. It works by approximating the slope of the true solution at discrete time steps, marching forward to iteratively calculate predicted values. In this example, Euler's method is used to solve a differential equation modeling the cooling of a hot ball. The temperature is calculated at 480 seconds using a step size of 240 seconds, and the numerical solution is compared to the exact solution to analyze the effect of step size in Euler's method.

Uploaded by

Ahmed Hassan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 12

Euler’s Method :Method of

solving differential equations of


the first order (the easy ones).

By: Ahmed Hassan and Monica Pabin


Euler’s Method
y

dy
 f  x, y  , y  0   y 0 True value
dx
y1, Predicted
Rise
Slope  x0,y0 Φ value
Run
y1  y 0
 Step size, h
x1  x0
 f  x0 , y 0  x

y1  y 0  f  x0 , y 0  x1  x0 
Figure 1 Graphical interpretation of the first step of Euler’s method
 y0  f  x0 , y0  h

2
Euler’s Method
y

yi 1  yi  f  xi , yi  h True Value

h  xi 1  xi yi+1, Predicted value

Φ
yi
h
Step size
x
xi xi+1

Figure 2. General graphical interpretation of Euler’s method

3
How to write Ordinary Differential
Equation
How does one write a first order differential equation in the form of

dy
 f  x, y 
dx

Example
dy
 2 y  1.3e  x , y  0   5
dx
is rewritten as
dy
 1.3e  x  2 y, y  0   5
dx
In this case

f  x, y   1.3e  x  2 y
4
Example
A ball at 1200K is allowed to cool down in air at an ambient temperature
of 300K. Assuming heat is lost only due to radiation, the differential
equation for the temperature of the ball is given by
d
dt
 
 2.2067 10 12  4  81108 ,   0  1200 K

Find the temperature at t  480 seconds using Euler’s method. Assume a step size of
h  240 seconds.

5
Solution
Step 1:
d
 2.2067  10 12   4  81 108 
dt
f  t ,   2.2067  10 12   4  81 108 
 i 1   i  f  ti , i  h
1   0  f  t0 , 0  h
 1200  f  0,1200  240
  
 1200   2.2067  10 12 1200 4  81 108 240
 1200    4.5579  240
 106.09 K
1 is the approximate temperature at t  t1  t0  h  0  240  240
  240  1  106.09 K
6
Solution Cont
Step 2: For i  1, t1  240, 1  106.09

 2  1  f  t1 , 1  h
 106.09  f  240,106.09  240
 
 106.09   2.2067  10 12 106.09 4  81 108 240
 106.09   0.017595 240
 110 .32 K

 2 is the approximate temperature at t  t2  t1  h  240  240  480

  480   2  110 .32 K

7
Solution Cont

The exact solution of the ordinary differential equation is given by the


solution of a non-linear equation as
  300
0.92593 ln  1.8519 tan 1  0.00333   0.22067  10 3 t  2.9282
  300

The solution to this nonlinear equation at t=480 seconds is

 (480)  647.57 K

8
Comparison of Exact and
Numerical Solutions
1400

1200
Temperature, θ(K)

1000
Exact Solution
800

600

400
h=240
200

0
0 100 200 300 400 500
Time, t(sec)

Figure 3. Comparing exact and Euler’s method

9
Effect of step size
Table 1. Temperature at 480 seconds as a function of step size, h

Step, h (480) Et |єt|%


480 −987.81 1635.4 252.54
240 110.32 537.26 82.964
120 546.77 100.80 15.566
60 614.97 32.607 5.0352
30 632.77 14.806 2.2864

 (480)  647.57 K (exact)

10
Comparison with exact results
1500

1000 Exact solution


Temperature, θ(K)

500
h=120
h=240
0
0 100 200 300 400 500
-500
Time, t (sec) h=480
-1000

-1500

Figure 4. Comparison of Euler’s method with exact solution for different step sizes

11
Effects of step size on Euler’s
Method
800

400
Temperature,θ(K)

0
0 100 200 300 400 500
-400
Step size, h (s)
-800

-1200

Figure 5. Effect of step size in Euler’s method.

12

You might also like