View
3
Download
0
Category
Preview:
Citation preview
8-2
Chapter 8 Differential Equations• An equation that defines a relationship between an
unknown function and one or more of its derivatives is referred to as a differential equation.
• A first order differential equation:
• Example:
),( yxfdxdy
5.05.2 obtain we,1 and 2 ngSubstituti25get weit, Solving
.1at 2 conditionboundary with,5
2
2
xyx y
cxy
xyxdxdy
school.edhole.com
8-3
• Example:
• A second-order differential equation:
• Example:
),,(2
2
dxdyyxf
dxyd
)( xycdxdy
'2'' yxyxy
school.edhole.com
8-4
Taylor Series Expansion• Fundamental case, the first-order ordinary differential
equation:
Integrate both sides
• The solution based on Taylor series expansion:
00 at subject to )( xxyyxfdxdy
x
x
y
ydxxfdy
00
)( x
xdxxfyxgy
0
)()(or 0
)()(' and )( where
...)(''!2
)()(')()()(
0000
0
20
00
xfxgxgy
xgxxxgxxxgxgy
school.edhole.com
8-5
Example : First-order Differential Equation
Given the following differential equation:
The higher-order derivatives:
1at 1such that 3 2 xyxdxdy
4nfor 0
6
6
3
3
2
2
n
n
dxyd
dxyd
xdx
yd
school.edhole.com
8-6
The final solution:
1 where
)1()1(3)1(31
)6(!3
)1()6(!2
)1()3)(1(1
!3)1(
!2)1()1(1)(
0
32
3
0
22
0
3
33
2
22
xxxx
xxxxx
dxydx
dxydx
dxdyxxg
school.edhole.com
8-7
x One Term Two Terms Three Terms Four Terms
1 1 1 1 11.1 1 1.3 1.33 1.3311.2 1 1.6 0.72 1.7281.3 1 1.9 2.17 2.197
1.4 1 2.2 2.68 2.7441.5 1 2.5 3.25 3.3751.6 1 2.8 3.88 4.0961.7 1 3.1 4.57 4.9131.8 1 3.4 5.32 5.8321.9 1 3.7 6.13 6.8592 1 4 7 8
Table: Taylor Series Solution
school.edhole.com
8-9
General Case
• The general form of the first-order ordinary differential equation:
• The solution based on Taylor series expansion:
00 at subject to ),( xxyyyxfdxdy
...),(''!2
)(),(')(),()( 000
00000
yxgxxyxgxxyxgxgy
school.edhole.com
8-10
Euler’s Method
• Only the term with the first derivative is used:
• This method is sometimes referred to as the one-step Euler’s method, since it is performed one step at a time.
edxdyxxxgxg )()()( 00
school.edhole.com
8-11
Example: One-step Euler’s Method
• Consider the differential equation:
• For x =1.1
Therefore, at x=1.1, y=1.44133 (true value).
1at 1such that 4 2 xyxdxdy
1.1
1
2
14 dxxdy
y
44133.0341
1.1
1
3 xy
school.edhole.com
8-12
0.008373. iserror The1.43296g(1.10)
valueestimated thesteps, fiveafter 0.02, of size stepa For 0.020833. toreduced iserror The
4205.1])05.1(4)[05.110.1()05.1()10.1(
2.12.01])1(4)[00.105.1()1()05.1(
:)05.1 and 1(at twiceequation sr'apply Eule and 0.05 of size stepa Use
value).absolute (in 0.04133error The4.1])1(4[1.01)1.1(
get we,1.0)( of size stepa With
2
2
2
0
gg
gg
xx
g
xxx
school.edhole.com
8-13
Errors with Euler`s Method• Local error: over one step size. Global error: cumulative over the range of the solution.• The error using Euler`s method can be approximated using the
second term of the Taylor series expansion as
• If the range is divided into n increments, then the error at the end of range for x would be n.
].,[ in maximum theis where
!2)(
02
2
2
220
xxdx
yddx
ydxx
school.edhole.com
8-14
Example: Analysis of Errors
0088.0)02.0)(1.1)(4(5
022.0)05.0)(1.1)(4(2
044.0)1.0)(1.1(4
:1.1at error theon limitsupper the0.02. and 0.05, 0.1, of sizes stepFor
)(4)8(!2
)(by bounded iserror theThus,
8
1at 1 that such 4
202.0
205.0
21.0
20
20
2
2
2
x
xxxxxx
xdx
yd
xyxdxdy
school.edhole.com
8-15
Table: Local and Global Errors with a Step Size of 0.1.
x Exact solution
Numerical Solution
Local Error(%)
Global Error(%)
1 1 1 0 01.1 1.4413333 1.4 -2.8677151 -2.86771511.2 1.9706667 1.884 -2.300406 -4.39783491.3 2.596 2.46 -1.9003595 -5.2388291.4 3.3253333 3.136 -1.6038492 -5.69366481.5 4.1666667 3.92 -1.396 -5-921.6 5.128 4.82 -1.1960478 -6.00624021.7 6.2173333 5.844 -1.0508256 -6.0047181.8 7.4426667 7 -0.9315657 -5.9476891.9 8.812 8.296 -0.8321985 -5.85565142 10.333333 9.74 -0.7483871 -5.7419355
school.edhole.com
8-16
x Exact solution
Numerical Solution
Local Error(%)
Global Error(%)
1 1 1 0 01.05 1.2101667 1.2 -0.8401047 -0.84010471.1 1.4413333 1.4205 -0.7400555 -1.44542091.15 1.6945 1.6625 -0.6589948 -1.88846271.2 1.9706667 1.927 -0.5920162 -2.21583221.25 2.2708333 2.215 -0.5357798 -2.45871561.3 2.596 2.5275 -0.4879301 -2.63867491.35 2.9471667 2.8655 -0.4467568 -2.7710231.4 3.3253333 3.23 -0.4109864 -2.86688051.45 3.7315 3.622 -0.3796507 -2.93447681.5 4.1666667 4.4025 -0.352 -2.98
Table: Local and Global Errors with a Step Size of 0.05.
school.edhole.com
8-17
x Exact solution
Numerical Solution
Local Error(%)
Global Error(%)
1.55 4.6318333 4.4925 -0.3274441 -3.00816811.6 5.128 4.973 -0.3055122 -3.02262091.65 5.6561667 5.485 -0.2858237 -3.02619561.7 6.2173333 6.0295 -0.2680678 -3.02112371.75 6.8125 6.6075 -0.2519878 -3.00917431.8 7.4426667 7.22 -0.2373701 -2.99175921.85 8.1088333 7.868 -0.2240355 -2.97001211.9 8.812 8.5525 -0.2118323 -2.94484791.95 9.5531667 9.2745 -0.2006316 -2.91700832 10.333333 10.035 -0.1903226 -2.8870968
Table: Local and Global Errors with a Step Size of 0.05 (continued).
school.edhole.com
8-18
x Exact solution Numerical Solution Local Error(%) Global Error(%)
1 1 1 0 0
1.02 1.0816107 1.08 -0.1489137 -0.1489137
1.04 1.1664853 1.163232 -0.1408219 -0.2789005
1.06 1.254688 1.24976 -0.1334728 -0.392767
1.08 1.3462827 1.339648 -0.1267688 -0.4928138
1.1 1.4413333 1.43296 -0.120629 -0.5809436
1.2 1.9706667 1.95312 -0.0963464 -0.8903924
1.3 2.596 2.56848 -0.0793015 -1.0600924
1.4 3.3253333 3.28704 -0.0667201 -1.1515638
1.5 4.1666667 4.1168 -0.057088 -1.1968
1.6 5.128 5.06876 -0.049506 -1.2137285
1.7 6.2173333 6.14192 -0.0434055 -1.212953
1.8 7.4426667 7.35328 -0.0384092 -1.2010032
1.9 8.812 8.70784 -0.0342563 -1.1820245
2 10.333333 10.2136 -0.0307613 -1.1587097
Table: Local and Global Errors with a Step Size of 0.02.
school.edhole.com
8-19
Modified Euler’s Method• Use an average slope, rather than the slope at the
start of the interval :a. Evaluate the slope at the start of the intervalb. Estimate the value of the dependent variable y at the
end of the interval using the Euler’s metod.c. Evaluate the slope at the end of the interval.d. Find the average slope using the slopes in a and c.e. Compute a revised value of the dependent variable y
at the end of the interval using the average slope of step d with Euler’s method.
school.edhole.com
8-20
Example : Modified Euler’s Method1at 1 that such xyyx
dxdy
10768.1)07684.1(1.01)0.11.1()0.1()1.1( 1e.
07684.1)15369.11(21 1d.
15369.11.11.1 c.1
1.1)1(1.01)0.11.1()0.1()1.1( 1b.
111 a.1
:1.0for iterationfirst theof steps five The
1.1
1
1
a
a
dxdygg
dxdydxdy
dxdygg
dxdy
x
school.edhole.com
8-21
23193.1)1.12.1()1.1()2.1( 2e.
24251.1)(21 2d.
32732.122345.12.1 c.2
22345.1)15771.1(1.010768.1)1.12.1()1.1()2.1( 2b.
15771.110768.11.1 a.2
:interval second for the steps The
2.11.1
2.1
1.1
1.1
a
a
dxdygg
dydx
dydx
dydx
dxdy
dxdygg
yxdxdy
school.edhole.com
8-22
Second-order Runge-Kutta Methods
• The modified Euler’s method is a case of the second-order Runge-Kutta methods. It can be expressed as
xhxxxxxgyxgy
hyxhfyhxfyxfyy
ii
iiii
iiiiiiii
, ),( ),( where
))],(,(),([5.0
1
1
1
school.edhole.com
8-23
• The computations according to Euler’s method:1. Evaluate the slope at the start of an interval, that is,
at (xi,yi) .
2. Evaluate the slope at the end of the interval (xi+1,yi+1) :
3. Evaluate yi+1 using the average slope S1 of and S2 :
),(1 ii yxfS
),( 12 hSyhxfS ii
hSSyy ii )(5.0 211
school.edhole.com
8-24
Third-order Runge-Kutta Methods
• The following is an example of the third-order Runge-Kutta methods :
hyxhfyhxhfyxhfyhxf
yxhfyhxfyxfyy
iiiiiiii
iiiiiiii
)))],(5.0,5.0(2),(,(
)),(5.0,5.0(4),([61
1
school.edhole.com
8-25
• The computational steps for the third-order method: 1. Evaluate the slope at (xi,yi).
2. Evaluate a second slope S2 estimate at the mid-point in of the step as
3. Evaluate a third slope S3 as
4. Estimate the quantity of interest yi+1 as
)5.0,5.0( 12 hSyhxfS ii
)2,( 213 hShSyhxfS ii
hSSSyy ii ]4[61
3211
),(1 ii yxfS
school.edhole.com
8-26
Fourth-order Runge-Kutta Methods
1. Compute the slope S1 at (xi,yi).
2. Estimate y at the mid-point of the interval.
3. Estimate the slope S2 at mid-interval.
4. Revise the estimate of y at mid-interval
. at that such ),( 00 hxxxyyyxfdxdy
),(1 ii yxfS
),(22/1 iiii yxfhyy
)5.0,5.0( 12 hSyhxfS ii
22/1 2Shyy ii
school.edhole.com
8-27
5. Compute a revised estimate of the slope S3 at mid-interval.
6. Estimate y at the end of the interval.
7. Estimate the slope S4 at the end of the interval
8. Estimate yi+1 again.
)5.0,5.0( 23 hSyhxfS ii
31 hSyy ii
),( 34 hSyhxfS ii
)22(6 43211 SSSShyy ii
school.edhole.com
8-28
Predictor-Corrector Methods
• Unless the step sizes are small, Euler’s method and Runge-Kutta may not yield precise solutions.
• The Predictor-Corrector Methods iterate several times over the same interval until the solution converges to within an acceptable tolerance.
• Two parts: predictor part and corrector part.
school.edhole.com
8-29
Euler-trapezoidal Method
• Euler’s method is the predictor algorithm.• The trapezoidal rule is the corrector equation.• Eluer formula (predictor):
• Trapezoidal rule (corrector):
The corrector equation can be applied as many times as necessary to get convergence.
,*,*,1
iiji dx
dyhyy
][2 1,1,*
,*,1
jii
iji dxdy
dxdyhyy
school.edhole.com
8-30
Example 8-6: Euler-trapezoidal Mehtod
1at 1 that such :Problem xyyxdxdy
1.1)1(1.01
1.0
111
is 1.1at for estimate )(predictor initial The
0,1
0,0,*00,1
0,0
y
dxdyyy
dxdy
xy
15369.11.11.1
:estimate theimprove toused is equationcorrector The
0,1
dxdy
school.edhole.com
8-31
10789.115782.1121.01
2
15782.110789.11.1
10789.115771.1121.01
2
15771.110768.11.1
10768.115369.1121.01
2
2,10,0,*03,1
2,1
1,10,0,*02,1
1,1
0,10,0,*01,1
dxdy
dxdyhyy
dxdy
dxdy
dxdyhyy
dxdy
dxdy
dxdyhyy
. have weAnd.1.1at 1.10789 toconverges , Since
3,1,*1
2,13,1
yyxyyy
school.edhole.com
8-32
22367.1)15782.1(1.010789.1
:equationpredictor the,2.1at of estimate For the
,*1,*10,2
dxdyhyy
xy
33203.123215.12.1
23215.132744.115782.121.010789.1
2
32744.122367.12.1
:equationcorrector The
2,2
1,2,*1,*11,2
1,2
dxdy
dxdy
dxdyhyy
dxdy
school.edhole.com
8-33
1.23239. is 2.1at of estimate The.iterations threein converges algorithmcorrector theAgain,
23239.133215.115782.121.010789.1
2
33215.123238.12.1
23238.133203.115782.121.010789.1
2
3,2,*1,*13,2
3,2
2,2,*1,*12,2
xy
dxdy
dxdyhyy
dxdy
dxdy
dxdyhyy
school.edhole.com
8-34
Milne-Simpson Method
• Milne’s equation is the predictor euqation.• The Simpson’s rule is the corrector formula. • Milne’s equation (predictor):
For the two initial sampling points, a one-step method such as Euler’s equation can be used.
• Simpsos’s rule (corrector):
]22[3
4
,*2,*1,*,*30,1
iiiii dx
dydxdy
dxdyhyy
]4[3 ,*1,*,1
,*1,1
iiji
iji dxdy
dxdy
dxdyhyy
school.edhole.com
8-35
Example 8-7: Milne-Simpson Mehtod
.4.1 and 3.1at estimate want toWe
1at 1 that such :Problem
xxy
xyyxdxdy
1 1 1
1.1 1.10789 1.15782
1.2 1.23239 1.33215
Assume that we have the following values, obtained from the Euler-trapezoidal method in Example 8-6.
x y dxdy
school.edhole.com
8-36
51917.136560.13.1
36560.1)33215.1(1.023239.1
:used be can method sEuler', 3.1at for estimate )(predictor initial thecompute To
0,3
,*2,*20,3
dxdy
dxdyhyy
xy
37474.1
15782.1)33215.1(451917.131.010789.1
431.0
:formularcorrector The
,*1,*20,3,*11,3
dxdy
dxdy
dxdyyy
school.edhole.com
8-37
37492.1
15782.1)33215.1(452434.131.010789.1
52434.137491.13.1
37491.1
15782.1)33215.1(452424.131.010789.1
52424.137474.13.1
3,3
2,3
2,3
1,3
y
dxdy
y
dxdy
The computations for x=1.3 are complete.
school.edhole.com
8-38
The Milne predictor equation for estimating y at x=1.4:
53762.1
15782.1233215.152434.123
1.041
223
4
,*1,*2,*3,*00,4
dxdy
dxdy
dxdyhyy
73610.153762.14.11,4
dxdy
The corrector formular:
school.edhole.com
8-39
complete. isit Then
53791.133215.152434.1473617.131.023239.1
73617.153791.14.1
53791.1
33215.152434.1473601.131.023239.1
43
2,4
2,4
,*2,*30,4,*21,4
y
dxdy
dxdy
dxdy
dxdyhyy
school.edhole.com
8-40
Least-Squares Method
• The procedure for deriving the least-squares function:
1. Assume the solution is an nth-order polynomial:
2. Use the boundary condition of the ordinary differential equation to evaluate one of (bo,b1,b2,…,bn).
3. Define the objective function:
nnx xbxbbby 2
210ˆ
dxeFx 2
dxdy
dxyde ˆ
whereschool.edhole.com
8-41
4. Find the minimum of F with respect to the unknowns (b1,b2, b3,…,bn) , that is
5. The integrals in Step 4 are called the normal equations; the solution of the normal equations yields value of the unknowns (b1,b2, b3,…,bn).
xallii
dxbee
bF 02
school.edhole.com
8-42
Example 8-8: Least-squares Method
2/2
:solution Analytical
1.x0 interval for theit Solve
0at 1 that such :Problem
xey
xyxydxdy
1
1
0
10
10
ˆ
1ˆ is modellinear theThus .1 yields
)0(1ˆ conditionboundary theUsing
ˆ
bdxyd
xbyb
bby
xbby
• First, assume a linear model is used:
school.edhole.com
8-43
0)543
22
(
0)1)](1([22
1
)1( :functionerror The
0
51
431
2
1
0 0
211
1
2
1
111
x
x x
xbxxbxxb
dxxxbxbdxdbdee
xdbde
xbxbxybe
xy
x
x
3215
3215
1
1ˆ
Thus, .bget we,1 withintegral above
thesolve ,10 range thein interested are weSince
school.edhole.com
8-44
x True y Value Numerical y Value Error (%)
0 1. 1. -
0.2 1.0202 1.0938 7.2
0.4 1.0833 1.1875 9.6
0.6 1.1972 1.2812 7.0
0.8 1.3771 1.3750 0.0
1.0 1.6487 1.46688 -10.9
Table: A linear model for the least-squares method
2/2xey xy 32151ˆ
school.edhole.com
8-45
• Next, to improve the accuracy of estimates, a quadratic model is used:
xxxbxb
xbxbxxbbxyxbbe
xbbdxyd
bbbby
xbxbby
)2()1(
)1(22
is functionerror The
2ˆ
.1 yields)0()0(1ˆ
conditionboundary theUsingˆ
32
21
2212121
21
0
2210
2210
school.edhole.com
8-46
41
125
158
:limitupper theas 1 Using
046524
33
2
0121
1
21
0
462
51
2422
2
31
1
0
232
21
2
1
bbx
xxbxbxxbxbxbxb
dxxxxxbxb
xbe
x
x
school.edhole.com
8-47
2
21
21
0
572
51
252
42
412
1
0
332
21
3
2
78776.014669.01ˆ
.78776.0 and 14669.0get We157
10571
209
:limitupper theas 1 Using
05753
25
43
44
2
02212
2
xxy
bb
bbx
xxbxbxxbxbxbxb
dxxxxxxbxb
xxbe
x
x
school.edhole.com
8-48
x True y Value Numerical y Value Error (%)
0 1. 1. -
0.2 1.0202 1.0022 -1.8
0.4 1.0833 1.0674 0.0
0.6 1.1972 1.1956 0.0
0.8 1.3771 1.38668 0.0
1.0 1.6487 1.6411 0.0
Table: A quadratic model for the least-squares method
2/2xey 278776.014669.01ˆ xxy
school.edhole.com
8-49
Galerkin Method
• Example: Galerkin Method The same problem as Example 8-8. Use the quadratic approximating equation.
ii
i
x i
bew
w
niedxw
method, squaresleast For the
factor. nga weighti is where
...2,1 0
. and Let 221 xwxw
school.edhole.com
8-50
2
21
21
1
0
232
21
1
0
32
21
85526.026316.01ˆ
:result final The41
31
152
31
157
121
:equations normal following get the We
0])2()1([
0])2()1([
xxy
bb
bb
dxxxxxbxb
xdxxxxbxb
school.edhole.com
8-51
Table: Example for the Galerkin method
x True y value Numerical y value Error (%)
0 1. 1. --
0.2 1.0202 0.9816 0.0
0.4 1.0833 1.0316 0.0
0.6 1.1972 1.1500 0.0
0.8 1.3771 1.3368 0.0
1.0 1.6487 1.5921 0.0
2/2xey 285526.026316.01ˆ xxy
school.edhole.com
8-52
Higher-Order Differential Equations
• Second order differential equation:
Transform it into a system of first-order differential equations.
dxdy
dxdyyyy
ydxdy
yyxfdxdy
121
21
212
and where
),,(
dxdyyxf
dxyd ,,2
2
school.edhole.com
8-53
• In general, any system of n equations of the following type can be solved using any of the previously discussed methods:
),...,,(
),...,,(
),...,,(
),...,,(
21
2133
2122
2111
nnn
n
n
n
yyyxfdxdy
yyyxfdxdy
yyyxfdxdy
yyyxfdxdy
school.edhole.com
8-54
Example: Second-order Differential Equation
EIXX
EIM
dXYd 2
2
2 10 :Problem
ZdXdY
EIXX
EIM
dXdZ
10
:into med transforbe canIt 2
hZYXfYYhZYXfZZ
ZYXEI
iiiii
iiiii
),,( ),,(
:equations following thesolve tomethod s Euler'Use02314.0 and 0,0at 3600 Assume
11
21
school.edhole.com
8-55
Table: Second-order Differential Equation Using a Step Size of 0.1 Ft
X (ft)
Y (ft)
Exact Z Exact Y(ft)
0 0 -0.0231481 0 -0.0231481 0
0.1 0.000275 -0.0231481 -0.0023148 -0.0231344 -0.0023144
0.2 0.0005444 -0.0231206 -0.0046296 -0.0230933 -0.004626
0.3 0.0008083 -0.0230662 -0.0069417 -0.0230256 -0.0069321
0.4 0.0010667 -0.0229854 -0.0092483 -0.0229319 -0.0092302
0.5 0.0013194 -0.0228787 -0.0115469 -0.0228125 -0.0115177
0.6 0.0015667 -0.0227468 -0.0138347 -0.0226681 -0.0137919
0.7 0.0018083 -0.0225901 -0.0161094 -0.0224994 -0.0160505
0.8 0.0020444 -0.0224093 -0.0183684 -0.0223067 -0.018291
0.9 0.002275 -0.0222048 -0.0206093 -0.0220906 -0.020511
dXdZ
dXdYZ
school.edhole.com
8-56
Table: Second-order Differential Equation Using a Step Size of 0.1 Ft (continued)
dXdZ
dXdYZ
X (ft)
Y (ft)
Exact Z Exact Y(ft)
1 0.0025 -0.0219773 -0.0228298 -0.0218519 -0.0227083
2 0.0044444 -0.0185565 -0.0434305 -0.0183333 -0.04296663
3 0.0058333 -0.0134412 -0.0298019 -0.0131481 -0.0588194
4 0.0066667 -0.007187 -0.0704998 -0.0068519 -0.0688889
5 0.0069444 -0.0003495 -0.0746352 0.00000000 -0.071228
6 0.0066667 0.0065157 -0.0718747 0.0068519 -0.0688889
7 0.0058333 0.0128532 -0.06244066 0.0131481 -0.0588194
8 0.0044444 0.0181074 -0.0471107 0.0183333 -0.042963
9 0.0025 0.0217227 -0.0272183 0.0278519 -0.0227083
10 0.000000 0.0231435 -0.00466523 0.0231481 0.000000
school.edhole.com
Recommended