Differential equations
Many of the laws in physics, chemistry, engineering, economics are based on empirical
observations that describe changes in the state of the system. Mathematical models that
describe the state of such system are often expressed in terms of not only certain system
parameters but also their derivatives, such mathematical model which uses differential
calculus to express relationship between variables are known as differential equations.
Examples:
Here
β’ The quantity y that is being differentiated is called dependent variable.
β’ The quantity with respect to which the dependent variable is differentiated is called
independent variable.
β’ If there is only one independent variable then the equation is called an ordinary
differential equation.
β’ If the equation contains more than one independent variable then it is called partial
differential equation
Order of equation
The highest derivative that appears in the equation is called order. If there is only first
derivative then it called first order differential equation.
Degree of equation
The degree of differential equation is the power of the highest order derivative
Initial value problem
In order to obtain the values of the integration constant, we need additional information for example consider the solution π¦ = ππ π₯ to the equation π¦ β² = π¦. if we are giving a value of y for some x, the constant a can be determined, suppose y=1 when x=0, then π¦(0) = ππ 0 = 1,
β΄ π = 1 and particular solution is π¦ = π π₯
It is also possible to specify the condition at different values of the independent variables such problems are called boundary value problem.
Example π¦ ” = π(π₯, π¦, π¦ β² ) π¦(π) = π΄, π¦(π) = π΅ π€βπππ π & π πππ π‘π€π πππππππππ‘ πππππ‘π .
Solution of ordinary differential equations
- Taylorβs series method
- Eulerβs method
- Heunβs method
- Rungeβs method
- Rungeβs Kutta 4th order method
- Shooting method
- Picardβs method
- R.K method for simultaneous equations
- Solution of higher order differential equation
Taylorβs series
Taylor series is often used in determining the order of errors for methods and the series itself is the basic for some numerical procedures.
Β Let π¦ β² = π(π₯, π¦), π¦(π₯0 ) = π¦0 (1)
Be the differential equation to which the numerical solution is required. Expanding π¦(π₯) about π₯ = π₯0 by Taylor Series we get
Here π¦0 β² , π¦0 β²β² , π¦0 β²β²β² β¦ can be found using equation (1) and its successive differentiation at π₯ = π₯0. The series in (4) can be truncated at any stage if βhβ is small. Now having obtained π¦1we can calculate π¦1 β² , π¦1 β²β² , π¦1 β²β²β² from equation (1) at π₯ = π₯0 + h
Β Now expanding π¦(π₯) by Taylor series about π₯ = π₯1, we get
By taking sufficient number of terms in above series the value of π¦πcan be obtained without much error
Β If a Taylor series is truncated while there are still non-zero derivatives of higher order the truncated power series will not be exact. The error term for a truncated Taylor Series can be written in several ways but the most useful form when the series is truncated after π π‘β term is
Where π is a value between x and (x+a). the value of π is ordinarily not known so there is
some uncertainty in the exact value of error still this term can give bounds for the errors.
Example:
Eulerβs method
Eulerβs method is the simplest one step method. It has limited application because of its low
accuracy. From Taylorβs theorem we have
Taking only first two terms only π¦(π₯) = π¦(π₯0 ) + π¦ β² (π₯0 )(π₯ β π₯0 )
Now we get
π¦(π₯1 ) = π¦1 = π¦(π₯0 ) + (π₯1 β π₯0 )π(π₯0, π¦0 )
where π₯ = π₯1, π(π₯0, π¦0 ) = π¦ β² (π₯0 )
Now let β = π₯1 β π₯0 π¦1 = π¦0 + βπ(π₯0, π¦0)
Similarly π¦2 = π¦1 + βπ(π₯1, π¦1)
In general π¦π+1 = π¦π + βπ(π₯π , π¦π)
This formula is known as Eulerβs method and can be used recursively to evaluate y1, y2 β¦ starting from the initial condition π¦0 = π¦(π₯0)
- A new value of y is estimated using the previous value of y as initial condition.
- The term hf(xi,yi) represents the incremental value of y and f(xi,yi) is the slope of y(x) at (xi,yi), the new value is obtained by extrapolating linearly over the step size h using the slope at its previous value. i.e. new value =old value + slope x step size
Example : Given the equation π¦ β² (π₯) = 3π₯ 2 + 1, with y(1)=2, estimate y(2), using eulerβs method using h=0.5 & h=0.25,
Solution π¦ β² (π₯) = π(π₯, π¦) = 3π₯ 2 + 1
π¦(1) = 2, π¦(π₯0 ) = π¦0, π₯0 = 1, π¦0 = 2
We know that
π¦π+1 = π¦π + βπ(π₯π , π¦π)
a. h=0.5
π¦1 = π¦(1 + 0.5) = π¦(1.5) = π¦0 + βπ(π₯0, π¦0 ) = π¦(1) + 0.5 Γ (3 Γ 1 2 + 1) = 2 + 0.5 Γ 4 = 4
π¦1 = π¦(2.0) + π¦(1.5 + 0.5) = π¦1 + βπ(π₯1, π¦1 ) = π¦(1.5) + 0.5 Γ π(π₯1.5, π¦1.5 )
= 4 + 0.5 Γ (3 Γ 1.5 2 + 1)
= 7.8750
β΄ π¦(2) = 7.8750
b. h=0.25
π¦(1) = 2
π¦1 = π¦(1 + 0.25) = π¦(1.25) = π¦0 + βπ(π₯0, π¦0 ) = 2 + 0.25 Γ π(1,2) = 2 + 0.25(3 Γ 1 2 + 1) = 3
π¦2 = π¦(1.25 + 0.25) = π¦(1.5) = π¦1 + βπ(π₯1, π¦1 ) = 3 + 0.25 Γ π(1.25,3) = 3 + 0.25(3 Γ 1.252 + 1) = 4.4218 π¦3 = π¦(1.5 + 0.25) = π¦(1.75) = π¦2 + βπ(π₯2, π¦2 ) = 4.4218 + 0.25 Γ π(1.5,4.4218) = 4.4218 + 0.25(3 Γ 1.5 2 + 1) = 6.3593
π¦4 = π¦(1.75 + 0.25) = π¦(2.0) = π¦3 + βπ(π₯3, π¦3 ) = 6.3593 + 0.25 Γ π(1.75,6.3593) = 6.3593 + 0.25(3 Γ 1.752 + 1) = 8.9061
β΄ π¦(2.0) = 8.9061
Heunβs method
Eulerβs method is the simplest of all one step methods. It is easy to implement on computers.
One of the major weakness is large truncation error in Eulerβs method. This is due to the fact
that Eulerβs method uses only the first two terms of Taylorβs series. Now heunβs method also
called improved Eulerβs method.
In Eulerβs method the slope at the beginning of the interval is used to extrapolate yi to yi+1 over the entire interval, thus
π¦π+1 = π¦π + π1β. . . . . . . . π
where m1 is the slope at(xi,yi).
Alternative is to use the line which is parallel to the tangent at the point [π₯π+1, π¦(π₯π+1 )] to extrapolate from π¦π π‘π π¦π+1
π¦π+1 = π¦π+ π2β. . . . . . . . π
Where is m2 is the slope at [π₯π+1, π¦(π₯π+1 )]. Note that the estimate appears to be overestimated.
Now a third approach is to use a line whose slope is the average of the slopes at the end
points of the interval, i.e
This gives the better approximation to π¦π+1, this approach is known as Heunβs method. The formula for implementing Heunβs method can be constructed easily as π¦ β² (π₯) = π(π₯, π¦)
Note that the term yi+1 appears on both sides. The value yi+1 cannot be calculated until the value of yi+1 inside the function f(xi+1,yi+1) is available. This value can be predicted using Eulers formula as
π¦π+1 = π¦π + βπ(π₯π , π¦π)
Then the Heunβs formula can be written as:
Putting the value of eulerβs formula in above equation we get
Example :
Given the equation π¦ β² (π₯) = 2π¦/ π₯ with y(1)=2, estimate y(2) using 1) Eulerβs method 2) Heunβs method and compare the result. Take h=0.25
Solution
.
I. Eulerβs method
h=0.25, y(1)=2
The above equation can be done using the following formula, note this is same
problem but done using later formula, you can use any method which ever you feel
easy to use.
Runge kutta method
Runge Kutta Method refers to a family of one step methods used for numerical solution of initial value problems. They are all based on the general form of the extrapolation equation
π¦π+1 = π¦π + π ππππ Γ πππ‘πππ£ππ π ππ§π = π¦π + πβ
Where m represents the slope that is weighted averages of the slope at various points in the interval h. Runge Kutta(RK) methods are known by their order. For instance an RK method is called r-order Runge Kutta method when slope at r points are used to construct the weighted average slope m.
Eulerβs method is the first order RK method because it uses only one slope at (xi,yi) to estimate π¦π+1. Huenβs method is a second order RK method because it employs slope at two ends points of the interval. It demonstrated that higher order would be better the accuracy of estimates.
Fourth order Runge Kutta method(classical fourth order Runge Kutta method)
The classical fourth order Runge kutta method is given as
Runge Kutta (3rd order RK method)
Example :
Use the classical RK method to estimate y(0.4) when π¦ β² (π₯) = π₯ 2 + π¦ 2 with π¦(0) = 0, assume h=0.2.
Solution
Given condition
π¦(0) = 0, π(π₯, π¦) = π₯ 2 + π¦ 2
Runge Kutta method for simultaneous first order equation
Consider the simultaneous equation
With the initial conditions π¦(π₯0) = π¦0, π§(π₯0) = π§0 now starting from (π₯0, π¦0, π§0) the increment k and l in y and z are given by the following formula
π1 = βπ1(π₯0, π¦0, π§0) ; π1 = βπ2(π₯0, π¦0, π§0)
To compute y2,z2 we simply replace x0,y0,z0 by x1,y1,z1 in the above formulae
If we consider the second order R.K method
π1 = βπ1(π₯0, π¦0, π§0) ; π1 = βπ2(π₯0, π¦0, π§0)
π2 = βπ1(π₯0 + β, π¦0 + π1, π§0 + π1) ; π2 = βπ2(π₯0 + β, π¦0 + π1, π§0 + π1)
= 0.09077
π¦1 = π¦(0.1) = π¦0 + π = 1 + (β0.08614) = 0.91386
π§1 = π§(0.1) = π§0 + π = β1 + 0.09077 = β0.90923
Higher order equation
A higher order differential equation is in the form
RK method for second order differential equations
Consider the second order differential equation
Picard method of successive approximation
Consider the first order differential equation ππ¦/ ππ₯ = π(π₯, π¦) subjected to π¦(π₯0) = π¦0. We can integrate this to obtain the solution in the interval(x0,x).
The above equation can be written as dy = f(x, y)dx Integrating between the limits , we get
Since y appears under the integral sign on the right, the integration cannot be formed. The dependent variable should be replaced by either a constant or a function of x, since we know the initial value of y at x=x0 we may use this as a first approximation to the solution and the result can be used on the right hand side to obtain the next approximation.
Now by Picardβs methods first approximation we replace y by y0 in f(x,y) i.e
For second approximation y2 replace y by y1
The process is to be stopped when two values of y, are same to desired degree of accuracy
Note:
- This method is applicable only to a limited class of equations in which the successive
integration can be perform easily. - Sometimes it may not be possible to carry out the integration.
- It is not convenient method for computer-based solution.
Example : Use Picardβs method to approximate the value of y when x=0.1,0.2,0.3,0.4 & 0.5.
given that y=1 at x=0, yβ=1+xy, correct up to three decimal places
Shooting method
This method is called shooting method because it resembles an artillery problem. In this
method the given boundary value problem is first converted into an equivalent initial value
problem an then solved using any of the method discussed in previous section.
Consider the equation
π¦ ” = π(π₯, π¦, π¦ β² ) π¦(π) = π΄, π¦(π) = B
Letting π¦ β² = π§, we obtain the following set of two equations π¦ β² = π§ , π§ β² = π(π₯, π¦, π§). In order to solve this set as initial value problem we need two conditions at x=a, we have one condition y(a)=A and therefore require another condtion for z at x=a. let us assume that π§(π) = π1, where M1 is a guess. Note M1 represents the slope π¦ β² (π₯) ππ‘ π₯ = π thus the problem is reduced to as system two first order equation with initial conditions
π¦ β² = π§π¦(π) = π΄
π§ β² = π(π₯, π¦, π§)π§(π) = π1 β¦ β¦ (π)
Equation a can be solved for y and z using any one step ,method suing steps of h, until the solution at x=b is reached. Let the estimated value of y(x) at x=b be B1, if B1=B then we have obtained the required solution. In practice it is very unlikely that our initial guess z(a)=M1 is correct.
If π΅1 β π΅ then we obtain the solution with another guess say z(a) =M2. Let new estimate of y(x) be at x=b be B2. If B2 is not equal to B then process is continued till we obtain the correct estimate of y(b). however the procedure can be accelerated by suing an improves guess for z(0) after estimates of B1 & B2 are obtained.
Let us assume that z(a)=M3 lead to the value of y(b)=B, if we assume that values of M and B are linearly related then
Now with z(a)=M3, we can again obtain the solution of y(x).
Reference 1 : Numerical Methods , Dr. V.N. Vedamurthy & Dr. N. Ch. S. N. Iyengar, Vikas Publishing House.