8/8/2015 1 euler method major: all engineering majors authors: autar kaw, charlie barker

16
06/14/22 http:// numericalmethods.eng.usf.edu 1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker http://numericalmethods.eng.u sf.edu Transforming Numerical Methods Education for STEM Undergraduates

Upload: irene-west

Post on 23-Dec-2015

224 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

04/19/23http://

numericalmethods.eng.usf.edu 1

Euler Method

Major: All Engineering Majors

Authors: Autar Kaw, Charlie Barker

http://numericalmethods.eng.usf.eduTransforming Numerical Methods Education for STEM

Undergraduates

Page 2: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

Euler Method

http://numericalmethods.eng.usf.edu

Page 3: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

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

Page 4: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

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

Page 5: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

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,

Page 6: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

http://numericalmethods.eng.usf.edu6

ExampleA 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

Kdt

d12000,1081102067.2 8412

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

240h seconds.

Page 7: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

http://numericalmethods.eng.usf.edu7

Solution

K

f

htf

htf iiii

09.106

2405579.41200

24010811200102067.21200

2401200,01200

,

,

8412

0001

1

Step 1:

1 is the approximate temperature at 240240001 httt

K09.106240 1

8412 1081102067.2

dt

d

8412 1081102067.2, tf

Page 8: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

http://numericalmethods.eng.usf.edu8

Solution ContFor 09.106,240,1 11 ti

K

f

htf

32.110

240017595.009.106

240108109.106102067.209.106

24009.106,24009.106

,

8412

1112

Step 2:

2 is the approximate temperature at 48024024012 httt

K32.110480 2

Page 9: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

http://numericalmethods.eng.usf.edu9

Solution Cont

The exact solution of the ordinary differential equation is given by the solution of a non-linear equation as

9282.21022067.000333.0tan8519.1300

300ln92593.0 31

t

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

K57.647)480(

Page 10: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

http://numericalmethods.eng.usf.edu10

Comparison of Exact and Numerical Solutions

Figure 3. Comparing exact and Euler’s method

0

200

400

600

800

1000

1200

1400

0 100 200 300 400 500

Time, t(sec)

Te

mp

era

ture

,

h=240

Exact Solution

θ(K

)

Page 11: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

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

4802401206030

−987.81110.32546.77614.97632.77

1635.4537.26100.8032.60714.806

252.5482.96415.5665.03522.2864

http://numericalmethods.eng.usf.edu11

Effect of step size

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

K57.647)480( (exact)

Page 12: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

http://numericalmethods.eng.usf.edu12

Comparison with exact results

-1500

-1000

-500

0

500

1000

1500

0 100 200 300 400 500

Time, t (sec)Tem

per

atu

re,

Exact solution

h=120h=240

h=480

θ(K

)

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

Page 13: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

http://numericalmethods.eng.usf.edu13

Effects of step size on Euler’s Method

-1200

-800

-400

0

400

800

0 100 200 300 400 500

Step size, h (s) Te

mp

era

ture

, θ(K

)

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

Page 14: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

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

Page 15: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

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

Page 16: 8/8/2015  1 Euler Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker

THE END

http://numericalmethods.eng.usf.edu