Date post: | 04-Jun-2018 |
Category: |
Documents |
Upload: | tarek-hassan |
View: | 216 times |
Download: | 0 times |
of 21
8/14/2019 Lec._9BUE
1/21
1
ScheduleWeek Date Topic Classification of Topic
1 9 Feb. 2010 Introduction toNumerical Methods
and Type of Errors
Measuring errors, Binary representation,
Propagation of errors and Taylor series
2 14 Feb. 2010 Nonlinear Equations Bisection Method
3 21 Feb. 2010 Newton-Raphson Method
4 28 Feb. 2010 Interpolation Lagrange Interpolation
5 7 March 2010 Newton's Divided Difference Method
6 14 March 2010 Differentiation Newton's Forward and BackwardDivided Difference
7 21 March 2010 Regression Least squares
8 28 March 2010 Systems of LinearEquations
Gaussian Jordan
9 11 April 2010 Gaussian Seidel
10 18 April 2010 Integration Composite Trapezoidal and SimpsonRules
11 25 April 2010 Ordinary DifferentialEquations
Euler's Method
12 2 May 2010
Runge-Kutta 2nd and4th order Method
8/14/2019 Lec._9BUE
2/21
2
Exact solution to Separable andLinear differential equations
8/14/2019 Lec._9BUE
3/21
3
Ordinary differential equations of order one and degree one
1. Separable equations
Example 1
Solve the equation2
dy x
dx y given that (0) 1y
solution
By separating the variables of the equation we get
2y dy xdx
8/14/2019 Lec._9BUE
4/21
4
By integration
2y dy x dx then
3 2
3 2y x C The general solution of the equation
Now (0) 1y y=1 at x=0
then1 0
3 2C
1
3C
the solution of the equation is
3 2 1
3 2 3
y x
8/14/2019 Lec._9BUE
5/21
5
2. Linear equations
Linear equations are on the form
( ) ( )
dy
p x y q xdx
Example
212
dy y xdx x
2
1( )
2( )
p x
x
q x x
8/14/2019 Lec._9BUE
6/21
6
How to solve Linear equations
Linear equations are solved by using the following method
Step 1: Calculate the following integrating factor
( )p x dx
e
Step 2: The solution is then given by
( )y q x dx
8/14/2019 Lec._9BUE
7/21
7
Example 2
Solve the equation such that y(0)=244 ydx
dy
solution
This equation could be written on the form
44 ydx
dy
4)(
4)(
xq
xp
Thenxdxdxxp eee 4
4)(
8/14/2019 Lec._9BUE
8/21
8
The solution will be such that
( )y q x dx cedxeye xxx
444 4
Let x=0 , y=2 c=3
Thenxey 431
8/14/2019 Lec._9BUE
9/21
Euler Method
8/14/2019 Lec._9BUE
10/2110
Eulers 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 Eulers method
8/14/2019 Lec._9BUE
11/2111
Eulers Method
Step size
h
True Value
yi+1, Predicted value
yi
x
y
xi xi+1
Figure 2. General graphical interpretation of Eulers method
hyxfyy iiii ,1
ii xxh 1
8/14/2019 Lec._9BUE
12/2112
How to write Ordinary Differential
Equation
Example
50,3.12 yeydx
dy x
is rewritten as 50,23.1 yye
dx
dy x
In this case
yeyxf x 23.1,
How does one write a first order differential equation in the form of
yxfdx
dy,
8/14/2019 Lec._9BUE
13/2113
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
Kdtd 12000,1081102067.2 8412
Find the temperature at 480t seconds using Eulersmethod. Assume a step size of
240h seconds.
8/14/2019 Lec._9BUE
14/2114
Solution
K
f
htf
htf iiii
09.106
2405579.4120024010811200102067.21200
2401200,01200
,
,
8412
0001
1
Step 1:
1is the approximate temperature at 240240001 httt
K09.106240 1
8412 1081102067.2 dt
d
8412
1081102067.2,
tf
8/14/2019 Lec._9BUE
15/2115
Solution ContFor 09.106,240,1 11 ti
K
f
htf
32.110
240017595.009.106
240108109.106102067.209.10624009.106,24009.106
,
8412
1112
Step 2:
2 is the approximate temperatureat 48024024012 httt
K32.110480 2
8/14/2019 Lec._9BUE
16/21
8/14/2019 Lec._9BUE
17/2117
Comparison of Exact and
Numerical Solutions
Figure 3. Comparing exact and Eulers method
0
200
400
600
800
1000
1200
1400
0 100 200 300 400 500
Time, t(sec)
Temperature,
h=240
Exact Solution
(K
8/14/2019 Lec._9BUE
18/21
Step, h (480) Et |t|%
480
240
120
60
30
987.81
110.32
546.77
614.97
632.77
1635.4
537.26
100.80
32.607
14.806
252.54
82.964
15.566
5.0352
2.2864
18
Effect of step sizeTable 1. Temperature at 480 seconds as a function of step size, h
K57.647)480( (exact)
8/14/2019 Lec._9BUE
19/2119
Comparison with exact results
-1500
-1000
-500
0
500
1000
1500
0 100 200 300 400 500
Time , t (sec)Temperature,
Exact solution
h=120h=240
h=480
(K
Figure 4. Comparison of Eulers method with exact solution for different step sizes
8/14/2019 Lec._9BUE
20/2120
Effects of step size on Eulers
Method
-1200
-800
-400
0
400
800
0 100 200 300 400 500
Step size, h (s)Temperature,
(K
Figure 5. Effect of step size in Eulers method.
8/14/2019 Lec._9BUE
21/21