Beruflich Dokumente
Kultur Dokumente
Content
• Consider function y = f ( x ) , where x is independent
variables, and ! dy d y $ are its ordinary
2
# , 2 ,... &
derivative " dx dx %
Approximation Exact
yi+1 = yi + hyi ' = yi + hf (xi , yi ) 1 2 x 6 −32 x
y(x) = e + e
" e 2 x − 3y % 7 7
yi+1 = yi + 0.2 $ '
# 2 &
• Q4 page 196.
The equation of motion of a car with mass m (kg) moving
with velocity v (m/s) and resistance c (N s/m) is given by
dv
m = −cv, v(0) = 10m / s
dt
with m=3000kg, c=90 N s/m. Estimate the velocity of the
car till time t=10s with Δt=1s. If the exact solution is
v(t)=10e-0.03t, find the absolute errors.
Exercise
• Formula used in RK4;
1
yi+1 = y + ( k1 + 2k2 + 2k3 + k4 )
!i 6 ###"###$
valueof previous po int !
derivative at 4th order Taylor Series
where; k1 = hf (xi , yi )
! h k1 $
k2 = hf # xi + , yi + &
" 2 2%
! h k2 $
k3 = hf # xi + , yi + &
" 2 2%
k4 = hf ( xi + h, yi + k3 )
1 2 x 6 −32 x
Note that the exact solution is y(x) = e + e
7 7
By sketch; x0 x1 x2
0 0.2 0.4
More
1 accurate!!
yi+1 = y + ( A + 2B + 2C + D )
!i 6 ###"###
valueof previous po int ! $
Tutorial
END OF PART 1
To be continued!
PART 2
Boundary Value Problem (BVP)
• BVP approximate the
y(xi) values of a
system of linear yi+1 − yi−1
equations using y' ≈
FINITE
DIFFERENCE !#2h"# $
METHOD. 1st derivativeequation
• This was done by
replacing the
derivatives for the yi+1 − 2yi + yi−1
linear differential y" ≈
equation with finite 2
!##"## h $
difference
2nd derivativeequation
approximation
formulas.
differentiation by
substitute the “i” STEP 2 • Find the boundary value/equation of
“y0” and “yn”
value with:
• i=1, 2, 3…..n-1 STEP 3 • Write the equation in finite difference
form.
(without
differentiation) • From the system of linear equation,
i equation note
1 yi+1 (1− 0.1xi ) + yi−1 (1+ 0.1xi ) −1.88yi = 0.44xi x1=1.2
y1+1 (1− 0.1x1 ) + y1−1 (1+ 0.1x1 ) −1.88y1 = 0.44x1 y0=1.5
Substitute value x1, y0 into above equation y1
unknown
y2 (1− 0.1(1.2)) + (1.5)(1+ 0.1(1.2)) −1.88y1 = 0.44(1.2) y2
y2 (0.88) +1.68 −1.88y1 = 0.528
Simplify to system of linear equation
−1.88y1 + 0.88y2 = −1.152…system1
2 yi+1 (1− 0.1xi ) + yi−1 (1+ 0.1xi ) −1.88yi = 0.44xi x2=1.4
y2+1 (1− 0.1x2 ) + y2−1 (1+ 0.1x2 ) −1.88y2 = 0.44x2 y1
Substitute value x2 into above equation y2 unknown
y3 (1− 0.1(1.4)) + y1 (1+ 0.1(1.4)) −1.88y2 = 0.44(1.4) y3
y3 (0.86) + y1 (1.14) −1.88y1 = 0.616
Simplify to system of linear equation
1.14y1 −1.88y2 + 0.86y3 = 0.616…system2
$ 0 '
1.16 −1.88 0.84 '$ y3 ' $ 0.704 '
$ 0 0 1.18 −1.88 '&$ y4 ' $# −11.508 '&
# # &
" y % "
$ 1 ' $ 2.844 %'
$ y2 ' $ 4.768 '
$ '=$
$ y3 ' $ 7.365 ''
$ y4 ' # 10.746 &
# &
Example 8.4 (with differentiation)
Step 1: x Diagram
ordinate
x0 x1 x2 x3 x4 x5
1.0 2.0
y(2)=y’(2)-1.5
i equation note
0.16
0 yi+1 + yi−1 − yi (2 − 0.04xi ) = 0.04xi3 − x0=1.0
xi3 y−1 = y1 −1.6
0.16 y0
y1 + y−1 − y0 (2 − 0.04x0 ) = 0.04x03 − unknown
x03 y1
Substitute value x0, y-1 into above equation
0.16
y1 + (y1 −1.6) − y0 (2 − 0.04(1)) = 0.04(1)3 −
(1)3
Simplify to system of linear equation
−1.96y0 + 2y1 = 1.48…(system1)
1 0.16
y2 + y0 − y1 (2 − 0.04x1 ) = 0.04x13 − x1=1.2
x13 y0
Substitute value x1 into above equation y1 unknown
0.16 y2
y2 + y0 − y1 (2 − 0.04(1.2)) = 0.04(1.2)3 −
(1.2)3
Simplify to system of linear equation
y0 −1.952y1 + y2 = −0.023…(system2)
i equation note
2 0.16 x2=1.4
y3 + y1 − y2 (2 − 0.04x2 ) = 0.04x23 −
x23 y1
Substitute value x2 into above equation y2 unknown
0.16 y3
y3 + y1 − y2 (2 − 0.04(1.4)) = 0.04(1.4)3 −
(1.4)3
Simplify to system of linear equation
y1 −1.944y2 + y3 = 0.051…(system3)
3 0.16 x3=1.6
y4 + y2 − y3 (2 − 0.04x3 ) = 0.04x33 −
x33 y2
Substitute value x3 into above equation y3 unknown
0.16 y4
y4 + y2 − y3 (2 − 0.04(1.6)) = 0.04(1.6)3 −
(1.6)3
Simplify to system of linear equation
y2 −1.936y3 + y4 = 0.125…(system4)
i equation note
4 0.16 x4=1.8
y5 + y3 − y4 (2 − 0.04x4 ) = 0.04x43 −
x43 y3
Substitute value x4 into above equation y4 unknown
0.16 y5
y5 + y3 − y4 (2 − 0.04(1.8)) = 0.04(1.8)3 −
(1.8)3
Simplify to system of linear equation
y3 −1.993y4 + y5 = 0.206…(system5)
5 0.16 x5=2.0
y6 + y4 − y5 (2 − 0.04x5 ) = 0.04x53 −
x53 y4
unknown
Substitute value x5 and y6 into above equation y5
0.16 y6 = 0.4y5 + y4 + 0.6
(0.4y5 + y4 + 0.6) + y4 − y5 (2 − 0.04(2.0)) = 0.04(2.0)3 −
(2.0)3
Simplify to system of linear equation
24y4 −1.520y5 = −0.300…(system6)
Step 5: write all system (1 to 6) in matrix form and use any appropriate
method to solve the system of linear equations.
Final solution using matrix
" y % " %
" −1.96 2 0 0 0 0 %$ 1 ' $ 1.480
$ '$ y ' '
−0.023
$ 1 −1.952 1 0 0 0 '$ 2 ' $ '
$ 0 1 −1.944 1 0 0 '$ y3 ' $ 0.051 '
$ 0 ' =$ 0.125 '
0 1 −1.936 1 0 $ y '
$ '$ 4 ' $ '
$ 0 0 0 1 −1.993 1 '$ y5 ' $ 0.206 '
$# 0 0 0 0 2 −1.520 '&$ y ' $# −0.300 '
&
# 6 &
" y % " %
$ 1 ' $ −0.970 '
$ y2 ' $ −0.211 '
$ ' $ 0.535 '
y
$ 3 '=$ '
$ y4 ' $ 1.302 '
$ ' $ 2.111 '
y
$ 5 ' $ '
$ y ' # 2.975 &
# 6 &
• Tutorial Exercise (Q 9 & 10, page 197). Use suitable
method for each question.