04/20/23http://
numericalmethods.eng.usf.edu 1
Euler Method
Electrical Engineering Majors
Authors: Autar Kaw, Charlie Barker
http://numericalmethods.eng.usf.eduTransforming Numerical Methods Education for STEM
Undergraduates
Euler Method
http://numericalmethods.eng.usf.edu
http://numericalmethods.eng.usf.edu3
Euler’s Method
Φ
Step size, h
x
y
x0,y0
True value
y1, Predicted
value
00,, yyyxfdx
dy
Slope Run
Rise
01
01
xx
yy
00 , yxf
010001 , xxyxfyy
hyxfy 000 ,Figure 1 Graphical interpretation of the first step of Euler’s method
http://numericalmethods.eng.usf.edu4
Euler’s Method
Φ
Step size
h
True Value
yi+1, Predicted value
yi
x
y
xi xi+1
Figure 2. General graphical interpretation of Euler’s method
hyxfyy iiii ,1
ii xxh 1
http://numericalmethods.eng.usf.edu5
How to write Ordinary Differential Equation
Example
50,3.12 yeydx
dy x
is rewritten as
50,23.1 yyedx
dy x
In this case
yeyxf x 23.1,
How does one write a first order differential equation in the form of
yxfdx
dy,
http://numericalmethods.eng.usf.edu6
ExampleA rectifier-based power supply requires a capacitor to temporarily store power when the rectified waveform from the AC source drops below the target voltage. To properly size this capacitor a first-order ordinary differential equation must be solved. For a particular power supply, with a capacitor of 150 μF, the ordinary differential equation to be solved is
0,
04.0
)(2))(120cos(18max1.0
10150
1)(6
tvt
dt
tdv 0)0( v
Find voltage across the capacitor at t= 0.00004s. Use step size h=0.00002
0,
04.0
2))(120cos(18max1.0
10150
16
vt
dt
dv
0,
04.0
2))(120cos(18max1.0
10150
1,
6
vtvtf
hvtfvv iiii ,1
http://numericalmethods.eng.usf.edu7
SolutionStep 1:
00002.000002.0001 httt
V
f
hvtfvv
320.53
00002.010666.20
00002.00,04.0
020120cos18max1.0
10150
1
00002.00,00
,
6
6
0001
1vis the approximate voltage at
Vvv 320.5300002.0 1
0,0,0For 00 vti
http://numericalmethods.eng.usf.edu8
Solution ContStep 2:
shttt 00004.000002.000002.012
V
f
hvtfvv
307.53
00002.0000015000.0320.53
00002.00,04.0
)320.53(2))00002.0(120cos(18max1.0
10150
1320.53
00002.0322.53,00002.0322.53
,
6
1112
2vis the approximate voltage at
Vvv 307.5300004.0 2
320.53,00002.0,1For 11 vti
http://numericalmethods.eng.usf.edu9
Solution Cont
The solution to this nonlinear equation at t=0.00004 seconds is
Vv 974.15)00004.0(
http://numericalmethods.eng.usf.edu10
Comparison of Exact and Numerical Solutions
Figure 3. Comparing exact and Euler’s method
Step size,
0.000040.000020.00001
0.0000050.0000025
106.6453.30726.64015.99615.993
−90.667−37.333−10.666
−0.021991−0.019125
567.59233.7166.771
0.137660.11972
http://numericalmethods.eng.usf.edu11
Effect of step size
h tE %|| t
Table 1 Voltage at 0.00004 seconds as a function of step size, h
00004.0v
http://numericalmethods.eng.usf.edu12
Comparison with exact results
Figure 4. Comparison of Euler’s method with exact solution for different step sizes
http://numericalmethods.eng.usf.edu13
Effects of step size on Euler’s Method
Figure 5. Effect of step size in Euler’s method.
http://numericalmethods.eng.usf.edu14
Errors in Euler’s Method
It can be seen that Euler’s method has large errors. This can be illustrated using Taylor series.
...!3
1
!2
1 31
,
3
32
1
,
2
2
1,
1 ii
yx
ii
yx
iiyx
ii xxdx
ydxx
dx
ydxx
dx
dyyy
iiiiii
...),(''!3
1),('
!2
1),( 3
12
111 iiiiiiiiiiiiii xxyxfxxyxfxxyxfyy
As you can see the first two terms of the Taylor series
hyxfyy iiii ,1
The true error in the approximation is given by
...
!3
,
!2
, 32
hyxf
hyxf
E iiiit
are the Euler’s method.
2hEt
Additional ResourcesFor all resources on this topic such as digital audiovisual lectures, primers, textbook chapters, multiple-choice tests, worksheets in MATLAB, MATHEMATICA, MathCad and MAPLE, blogs, related physical problems, please visit
http://numericalmethods.eng.usf.edu/topics/euler_method.html