Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Introduction to Differential Equations
1. Introduction to DifferentialIntroduction to Differential
EquationsEquations
Prepared By :-
Divyanshi Bagrawala - 130420105003
Bhaumik Parikh - 130420105006
Bhumika Jariwala - 130420105019
Juhi Kala - 130420105025
Keval dalsaniya - 130420105030
Vishvaraj Chauhan - 130420105058
2. Definition:
A differential equation is an equation containing an unknown function
and its derivatives.
Equations which are composed of an unknown function and its derivatives are
called differential equations.
32 += x
dx
dy
032
2
=++ ay
dx
dy
dx
yd
36
4
3
3
=+
+ y
dx
dy
dx
yd
Examples:-
y is dependent variable and x is independent variable,
and these are ordinary differential equations
1.
2.
3.
Ordinary Differential Equations
3. Order of Differential Equation
The order of the differential equation is order of the highest
derivative in the differential equation.
Differential Equation ORDER
32 += x
dx
dy
0932
2
=++ y
dx
dy
dx
yd
36
4
3
3
=+
+ y
dx
dy
dx
yd
1
2
3
4. Degree of Differential Equation
Differential Equation Degree
032
2
=++ ay
dx
dy
dx
yd
36
4
3
3
=+
+ y
dx
dy
dx
yd
03
53
2
2
=+
+
dx
dy
dx
yd
1
1
3
The degree of a differential equation is power of the highest
order derivative term in the differential equation.
6. Taylor's Series method
Consider the one dimensional initial value problem
y' = f(x, y), y(x0
) = y0
where f is a function of two variables x and y and (x0
, y0
) is a known point on the
solution curve.
•If the existence of all higher order partial derivatives is assumed for y at x = x0
, then by
Taylor series the value of y at any neibhouring point x+h can be written as
y(x0
+h) = y(x0
) + h y'(x0
) + h2
/2 y''(x0
) + h3
/3! y'''(x0
) + . . . . . .
•where ' represents the derivative with respect to x. Since at x0
, y0
is known, y' at x0
can
be found by computing f(x0
,y0
). Similarly higher derivatives of y at x0
also can be
computed by making use of the relation
y' = f(x,y)
y'' = fx
+ fy
y'
y''' = fxx
+ 2fxy
y' + fyy
y'2
+ fy
y''
and so on.
Then
y(x0
+h) = y(x0
) + h f + h2
( fx
+ fy
y' ) / 2! + h3
( fxx
+ 2fxy
y' + fyy
y'2
+ fy
y'' ) / 3! + o(h4
)
Hence the value of y at any neighboring point x0
+ h can be obtained by summing the
7. Example: 1
Solve the initial value problem y' = -2xy2
, y(0) = 1 for y at x = 1 with step length 0.2 using Taylor series
method of order four.
Solution:
Given y' = f(x,y) = -2xy2
Þ y'' = -2y2
- 4xyy'
y''' = -8yy' - 4xy'2
- 4xyy''
yiv
= -12y'2
- 12yy'' - 12xy'y'' - 4xyy'''
yv
= -48y'y'' - 16yy''' -12xy''2
- 16xy'y''' - 4xyyiv
The forth order Taylor's formula is
y(xi+h) = y(xi) + h y'(xi, yi) + h2
y''(xi, yi)/2! + h3
y'''(xi, yi)/3! + h4
yiv
(xi, yi)/4!
given at x=0, y=1 and with h = .2 we have
y' = -2(0)(1)2
= 0.0
y'' = -2(1)2
- 4(0)(1)(0) = -2
y''' = -8(1)(0) - 4(0)(0)2
- 4(0)(1)(-2) = 0.0
yiv
= -12(0)2
- 12(1)(-2) - 12(0)(0)(-2) - 4(0)(1)(0) = 24
y(0.2) = 1 + .2 (0) + .22
(-2)/2! + 0 + .24
(24)/4! = .9615
now at x = .2 we have y = .9615
y' = -0.3699, y'' = -1.5648, y''' = 3.9397 and yiv
= 11.9953
then y(0.4) = 1 + .2 (-.3699) + .22
(-1.5648)/2! + .23
(3.9397)/3! + .24
(11.9953)/4! = 0.8624
y(0.6) = 1 + .2 (-.5950) + .22
(-0.6665)/2! + .23
(4.4579)/3! + .24
(-5.4051)/4! = 0.7356
y(0.8) = 1 + .2 (-.6494) + .22
(-0.0642)/2! + .23
(2.6963)/3! + .24
(-10.0879)/4! = 0.6100
y(1.0) = 1 + .2 (-.5953) + .22
(-0.4178)/2! + .23
(0.9553)/3! + .24
(-6.7878)/4! = 0.5001
8. now at x = 1.0 we have y = .5001
y' = -0.5001,
y'' = 0.5004,
y''' = -.000525 and yiv
= -3.0005
Error in the approximation
E4 = h4
(y4
(1.0) - y4
(0.8))/ 5! = h4
(-3.0005-11.9953)/ 5! = -1.9994e-004
Analytical solution y(x) = 1/(1+x2
) at x = 1, y = .5
Alternate method:
By Taylor series method
y(x0 + x - x0) = y0 + (x-x0)y'(x0) + (x-x0)2
y''(x0)/2! + (x-x0)3
y'''(x0)/3! + (x-
x0)4
yiv
(x0)/4! + . . .
Since x0 = y' = y''' = 0, y = 1, y'' = -2 and yiv
= 24 at x = 0,
y( x ) = 1. - x2
+ x4
+ . . .
10. Euler’s Method
Though in principle it is possible to use Taylor's method of
any order for the given initial value problem to get good
approximations, it has few draw backs like
•The scheme assumes the existence of all higher order
derivatives for the given function f(x,y) which is not a
requirement for the existence of the solution for any first
order initial value problem.
•Even the existence of these higher derivatives is guaranteed
it may not be easy to compute them for any given f(x,y).
•Because of the usage of higher order derivatives in the
formula it is not convenient to write computer programs , that
is the method is more suited for hand calculations.
11. To overcome these difficulties, Euler developed a scheme by
approximating y' in the given ivp. The scheme is as follows:
The derivative term in the first order ivp
y' = f(x, y) , y(x0
) = y0
is approximated by making use of Taylor series approximation of the
dependent variable y(x) at the point xi+1
. That is
y(xi+1
) = y(xi
+ ∆x) = y(xi
) + ∆xy'(xi
) + (∆x2
/ 2)y''(xi
) + . . .
= y(xi
) + ∆xf(xi
, yi
) + (∆x2
/ 2)y''(xi
) + . . .
(... y'(xi
) = f(xi
, yi
))
if the infinite series is truncated from the term ∆x2
onwards, then
y(xi+1
) = y(xi
) + ∆x y'(xi
) (or)
yi+1
= yi
+ ∆x fi
for all i
That is,
for i = 0, y1
= y0
+ ∆x f0
i = 1, y2
= y1
+ ∆x f1
i = n-1, yn
= yn-1
+ ∆x fn-1
12.
13. • The first derivative provides a direct estimate of the
slope at xi
where f(xi,yi) is the differential equation evaluated at xi
and yi. This estimate can be substituted into the
equation:
• A new value of y is predicted using the slope to
extrapolate linearly over the step size h.
),( ii yxf=φ
hyxfyy iiii ),(1 +=+
15. Error Analysis for Euler’s Method/
• Numerical solutions of ODEs involves two types of
error:
– Truncation error
• Local truncation error
• Propagated truncation error
– The sum of the two is the total or global truncation error
– Round-off errors
)(
!2
),(
2
2
hOE
h
yxf
E
a
ii
a
=
′
=
16. Example 3:
Find y(0.5) if y is the solution of IVP y' = -2x-y, y(0) = -1 using
Euler's method with step length 0.1. Also find the error in the
approximation.
Solution:
f(x, y) = -2x - y,
y1 = y0 + h f(x0, y0) = -1 + 0.1* (-2*0 - (-1)) = -0.8999
y2 = y1 + h f(x1, y1) = -0.8999 + 0.1* (-2*0 - (-0.8999)) = -0.8299
y3 = y2 + h f(x2, y2) = -0.8299 + 0.1* (-2*0 - (-0.8299)) = -0.7869
y4 = y3 + h f(x3, y3) = -0.7869 + 0.1* (-2*0 - (-0.7869)) = -0.7683
y5 = y4 + h f(x4, y4) = -0.7683 + 0.1* (-2*0 - (-0.7683)) = -0.7715
Truncation error in the approximation = ( h2
/2 ) f''(x), where 0 < x
<0.5
= 0.005 f''(x)
18. Modified Euler's Method :
The Euler forward scheme may be very easy to implement but it
can't give accurate solutions. A very small step size is required
for any meaningful result. In this scheme, since, the starting point
of each sub-interval is used to find the slope of the solution
curve, the solution would be correct only if the function is linear.
So an improvement over this is to take the arithmetic average of
the slopes at xi
and xi+1
(that is, at the end points of each sub-
interval). The scheme so obtained is called modified Euler's
method. It works first by approximating a value to yi+1
and then
improving it by making use of average slope.
If Euler's method is used to find the first approximation of yi+1
then
yi+1
= yi
+ 0.5h(fi
+ f(xi+1
, yi
+ hfi
))
19. Truncation error:
yi+1 = yi + h y'i + h2
yi'' /2 + h3
yi''' /3! + h4
yi
iv
/4! + . . .
fi+1 = y'i+1 = y'i + h y''i + h2
yi'''' /2 + h3
yi
iv
/3! + h4
yi
v
/4! + . . .
By substituting these expansions in the Modified Euler formula gives
yi + h y'i + h2
yi'' /2 + h3
yi''' /3! + h4
yi
iv
/4! + . . . = yi+ h/2 (y'i + y'i + h y''i
+ h2
yi'''' /2 + h3
yi
iv
/3! + h4
yi
v
/4! + . . . )
So the truncation error is: - h3
yi''' /12 - h4
yi
iv
/24 + . . . that is, Modified
Euler's method is of order two.
22. 22
Runge-Kutta Methods (RK)
• Runge-Kutta methods achieve the accuracy of a
Taylor series approach without requiring the
calculation of higher derivatives.
),(
),(
),(
),(
constants'
),,(
11,122,1111
22212133
11112
1
2211
1
hkqhkqhkqyhpxfk
hkqhkqyhpxfk
hkqyhpxfk
yxfk
sa
kakaka
hhyxyy
nnnnninin
ii
ii
ii
nn
iiii
−−−−−−
+
+++++=
+++=
++=
=
=
+++=
+=
φ
φ
Increment function
p’s and q’s are constants
23. •RK method of order 2nd
Order (v = 2)
K1 = h f(xi, yi)
K2 = h f(xi + h, yi + K1 )
yi+1 = yi + (K1 + K2 )/2 at xi+1 = xi + h
•RK method of order 4th
Order (v = 4)
K1 = h f(xi, yi)
K2 = h f(xi + h/2, yi + K1 /2)
K3 = h f(xi + h/2, yi + K2 /2)
K4 = h f(xi + h, yi + K3 )
yi+1 = yi + ( K1 + 2K2 + 2K3 + K4 )/6 at at xi+1 = xi + h
24. Example 6:
Using RK method of order four find y at x = 1.1 and 1.2 by solving y' = x2
+
y2
, y(1) = 2.3
Solution: Using RK method of order 4
Given y' = x*x+y*y,
y[1.00] = 2.3
with step-length = 0.1
K1 = 0.628999987438321
K2 = 0.7938110087671021
K3 = 0.83757991687511
K4 = 1.1054407603556848
y[1.10] = 3.1328703854960227
K1 = 1.102487701987972
K2 = 1.4895197934605002
K3 = 1.6358516854539997
K4 = 2.4180710557439085
y[1.20] = 4.761420671422837