Upload
others
View
8
Download
0
Embed Size (px)
Citation preview
SSCE2393NUMERICALMETHODS
CHAPTER8ORDINARYDIFFERENTIAL
EQUATION(ODE)
FarhanaJohar,DepartmentofMathematicalSciences,FacultyofScience,[email protected]
2
BoundaryValueProblem
OverviewofChapter8
8.1 Introductiontothechapter
8.2 InitialValueProblem(IVP)
8.3 BoundaryValueProblem(BVP)
8.1 IntroductiontoODE
Given ( )yxfy ,=ʹ
Wanttofind y
InitialValueProblem
3
8.1InitialValueProblem(IVP)
1. Euler’sMethod 1. R-Korder2 2.Taylor’sMtdorder2 2. R-Korder4
8.1.1Taylor’sMethoda) Euler’sMethod(Taylor’sMethodorder1)
)(!
)(!2
)()()( )(2
1 in
n
iiii xynhxyhxyhxyxy ++ʹ́+ʹ+=+ !
iii yhyy ʹ+=+1 i ix iy )( ixy (exact) error 0 Given 0y 1 ! N Exactsol.for ( )xy Absoluteerror(ifneeded)
Taylor’sSeriesMethod
Runge-KuttaMethod
4
Example:(Doallcalculationin4dcp)1.UseEuler’sMethodtoapproximatethesolutionsforthefollowingIVPs:
a) 25.0with21for2)1(,1 =≤≤=+=ʹ hxyxyy
Giventheactualsolutionis xxxy 2ln += .Computetheabsoluteerror.
b) 25.0with10for1)0(,3sin2cos =≤≤=+= htyttdtdy
Giventheactualsolutionis .343cos
312sin
21)( +−= ttty
Computetheabsoluteerror.2.Theequationfortheupwardvelocityvforarocketisgivenby:
0at0;103001.05000 2
==−−−
= tvgtv
dtdv where
vinm/s,tisthetimeinseconds,andgis9.81m/s2.Usetimestepsof2stosolveforvbytheEulermethod,andproduceatableof(t,v)valuesintimeincrementsof2supto10s.
5
3.Ifwaterisdrainedfromaverticalcylindricaltankbyopeningavalveatthebase,thewaterwillflowfastwhenthetankisfullandslowdownasitcontinoustodrain.Therateatwhichthewaterleveldropsis:
ykdtdy
−=
wherekisaconstant.Thedepthofthewater,yismeasuredinfeetandtime,tinminutes.Ifk=0.1,determinehowlongittakesthetanktodrainifthewaterlevelisinitially9ft.SolvebyapplyingEuler’smethodanduseastepof4minutes.b)Taylor’sMethodorder2
)(!
)(!2
)()()( )(2
1 in
n
iiii xynhxyhxyhxyxy ++ʹ́+ʹ+=+ !
iiii yhyhyy ʹ́+ʹ+=+ 2
2
1
i ix iy )( ixy (exact) |error|
0 Given 0y 1 ! n
6
Example:1.UseTaylor’sMethodoforder2toapproximatethesolutionsforthefollowingIVPs:
a) 1 ( ) , (2) 1 for 2 3 with 0.5y x y y x hʹ = + − = ≤ ≤ =
Giventheactualsolutionis(2 )xy x e −= − .Computethe
absoluteerror.
b) 5.0with30for0)0(,23 =≤≤=−=ʹ htyytey t
7
8.1.2Runge-KuttaMethoda)R-Korder2i)ImprovedEuler’sMethod
211 21
21 kkyy ii ++=+
where
),(1 ii yxhfk = ),( 12 kyhxhfk ii ++=
i ix iy 1k 2k Exact error 0 Given 0y 1 ! N
8
Example:(Calculationin4dcp)1.EmployImprovedEuler’smethodtosolvethefollowingproblem.Computetheabsoluteerror.
a)221 34 6 , (0) 1, 0 1, ( ) , 0.2
2 2tdy yt t y t y t e h
dt−+ = = ≤ ≤ = − + =
b)4 42 112 , (0) 3, 0 1, ( ) , 0.2
3 3x x xy y e y x y x e e hʹ − = = − ≤ ≤ = + =
9
ii)MidpointMethod 21 kyy ii +=+ where ),(1 ii yxhfk =
)2
,2
( 12
kyhxhfk ii ++=
iii)Heun’sMethod
yi+1 = yi +14k1 +3k2( )
where
k1 = hf (xi, yi )
k2 = hf (xi +23h, yi +
23k1)
10
Example:Solvethefollowingfirstorderinitialvalueproblemat
( )0 0.2 0.6x = bymid-pointmethod;
( ) 10,3'2 2 ==+ yeyy x
Giventheexactsolutionis 23
2
76
71 x
x eey−
+= .Determinethe
absoluteerroranddothecalculationin4decimalplaces.
11
b)R-Korder4
)22(61
43211 kkkkyy ii ++++=+
where ),(1 ii yxhfk =
)2
,2
( 12
kyhxhfk ii ++=
)2
,2
( 23
kyhxhfk ii ++=
),( 34 kyhxhfk ii ++=
i ix iy 1k 2k 3k 4k Exact error 0 Given 1 ! n Example:Solvethefollowingfirstorderinitialvalueproblemat
( ) 4.02.00=x byusingfourth-orderRunge-Kuttamethod;
( ) 10,3'2 2 ==+ yeyy x
Giventheexactsolutionis 23
2
76
71 x
x eey−
+= .Determinethe
absoluteerroranddothecalculationin4decimalplaces.
12
8.2BoundaryValueProblemConsider2typesofboundarycondition; Without With Differentiation DifferentiationSolvethese2typesofproblembyusingfinitedifferencemethod.
hyy
y iii 2' 11 −+ −≈
211 2
"h
yyyy iiii
−+ +−≈
a)BVPWithoutDifferentiation
( ) ( ) ( ) ( ) ( ) βα ===++ byayxryxqyxpy ,,''' Example:1.Solvethefollowingboundaryvalueproblemat ( )1 0.2 2x = byusingfinitedifferencemethod;
y ''+ 1x
⎛
⎝⎜
⎞
⎠⎟ y '−
1x 2⎛
⎝⎜
⎞
⎠⎟ y = 3 y 1( ) = 2, y 2( ) = 3
13
2.Solvethefollowingboundaryvalueproblem;
xyxy =⎟⎠⎞
⎜⎝⎛ −−ʹ́
51
( ) ( ) 5.0,13,21 =−== hyy b)BVPWithDifferentiation
( ) ( ) ( )
( )( ) ( ) 0,
0,
,'''
≠=ʹ+
≠=ʹ+
=++
nbynbmylylaky
xryxqyxpy
β
α
Example:1.Solvetheboundaryvalueproblemat ( )12.00=x byusingfinitedifferencemethod.
y ''+ 2xy '−3y = −6e−x 1+ x2( ), y ' 0( )+ 0y 0( ) = 3, y ' 1( ) = 0
(Exactsolution: ( ) xxexy −= 3 )2.SolvetheBVP; yy =ʹ́ ( ) ( ) 5.0,018.103,175.11 ==ʹ=ʹ hyy .