Solving First Order Ordinary Differential Equations Using Least Square Method A Comparative Study
Solving First Order Ordinary Differential Equations Using Least Square Method A Comparative Study
ISSN No:-2456-2165
Abstract:- In this research article an attempt has been Perturbation Method (HPM) and Variational Iteration
made to examine the performance of Finite difference Methods (VIM) are good methods [7]. Perturbation method
method (FDM) and Least square method (LSM) on the is another method but due to its drawback it is not that
solution of first order ordinary differential equations frequently adopted for the solution of ODE’s [8]. The
(ODE). Both FDM and LSM are applied on the test problems associated with linear stability in solving
problem and the results thus obtained are compared with differential equations have been talked by Hajmohammadi
the exact solution. It has been observed that for third and Nourazar [9].
degree basis function the results of LSM very close to the
analytical result. On further increasing the degree the Weighted residual-based methods are the schemes
improvement in the result is very meagre and N=3 can be which are approximation techiniques which are also adopted
considered as the optimum solution for LSM. It has also to solve differential equations. Ozisik first introduced Least
been observed that the FDM is very sensitive to the square method (LSM) and Galerkin techiniques which are
number of grid points and deviates from the exact results based on weighted residuals [10]. The solution of third order
by a substantive amount for lower number of nodes. differential equation based on collection method has been
Whereas the LSM is independent of the number of nodes. introduced by Stern and Rasmussen [11].
Keywords:- Least Square Method; Finite Difference Method; Finite difference method (FDM) is a very old method to
Ordinary Differential Equation; Python; Optimization. solve differential equations [12]. This is based on Taylor
series expansion [13]. In this method domain is divided into
Nomenclature: nodes and the differential equation is discretized at each node.
𝑥 independent variable
𝑦 dependent variable In this research article, LSM based solution of first order
i degree of basis function linear differential equation has been reported. FDM has also
j Node index been applied on the problem and the results of both the
D differential operator methods are compared with the exact analytical solution. This
𝑤𝑖 weight will dictate the accuracy of the LSM over FDM.
R residue
N Number of weights II. PROBLEM STATEMENT
E squared residuals
𝑦𝑒𝑥𝑎𝑐𝑡 exact solution In in this research article, we will be focusing on
𝑦̃ approximate function following one dimensional ordinary differential equation
𝜙𝑖 basis function (ODE):
Δ𝑥 spacing between nodes
𝑑𝑦
LSM Least square Method −𝑦 = 0 (1)
𝑑𝑥
FDM Finite difference method where, 0 ≤ 𝑥 ≤ 1.
ADM Adomian Decomposition Method
HPM Homotopy Perturbation Method As this is a first order ODE so this will have only one
boundary condition. Let say that when 𝑥 = 0 the value of 𝑦 =
I. INTRODUCTION 1(viz. 𝑦(0) = 1). The exact solution of the Eq. 1 is 𝑒 𝑥 which
will act as a benchmark to our optimization solution.
At the very core of every physical phenomenon lies
some sort of mathematical relation in the form of the III. LEAST SQUARE METHOD (LSM)
differential equation [1]. The behaviour of these equations
can be linear or non-linear [2]. So, several researchers have Least square method is one of the methods which is
devised many methods to solve these differential equations based on weighted residuals minimization. In this method a
[3]. Till very recent the solution of differential equations is trial function is introduced in the parent differential equation
mostly dominated by numerical computations but, very and then the residue is minimized. Let us consider a boundary
recently the analytical methods have gained popularity [4]. value problem as follows:
For solving differential equations semi-analytically 𝐷(𝑦) − 𝑓(𝑥) = 0
Adomian Decomposition Method (ADM) has been adopted (2)
by researchers [5], [6]. For non-linear equations Homotopy
Above equation is the backward difference Now Eq. 15 is the finite difference discretization of Eq.
approximation of first order. Also, this approximation is first 1 which is be solved for each node in the domain.
order accurate.
V. RESULTS AND DISCUSSION
FDM applied to the problem
Applying the above-mentioned method to the Eq. 1 we The objective of this study is to evaluate the
will get: performance of LSM to evaluate the solution of first order
𝑑𝑦 𝑦(𝑥)−𝑦(𝑥−Δ𝑥) ODE and its comparison with the Euler’s method. Figure 1(a)
−𝑦 = − 𝑦(𝑥) = 0 (13) shows the variation of LSM output, exact solution, and error
𝑑𝑥 Δ𝑥
as a function of domain length for different values of N. For
When it comes to computation the x will correspond to N=1 the LSM returns a liner relation between x and y which
the 𝑗𝑡ℎ node and (𝑥 − Δ𝑥) corresponds to the node just before is not what the exact solution tells hence, large deviation and
it viz. (𝑗 − 1). Now Eq. 13 then becomes: error. For N=2 (Figure 1(b)) the LSM results are close to
exact and still there is a little bit of error. When N is increased
𝑦𝑗 −𝑦𝑗−1
− 𝑦𝑗 = 0 (14) to 3 (Figure 1(c)), one can see that the error has reduced a lot
Δ𝑥
in comparison to N=1 and 2. And for N=4 and 5 (Figure 1(d)
and 1(e)) the error has almost reached zero.
On further simplification Eq. 14 becomes:
(a) N=1
(b) N=2
(c) N=3
(d) N=4
(e) N=5
Fig 1: Variation of y and error as a function of x for different N
One more thing to observe from Figure 1 is that as the order of basis function increases the lobes in the error function also
increase. The error presented is the exact error hence once can se its variation both in positive and negative direction. The number
of lobes in the error plot is representative of the degree of polynomial. For N=1 the polynomial is one so there is only one lobe and
at last for N=5 as the polynomial is of 5th order so the number of lobes in error plot is five, likewise for other values of N.
Figure 2 depicts the error for all N’s in one figure. As the N goes from 1 to 3 the error the error reduces drastically to a very
small value. In fact, N=3 can be considered as the optimum solution of the problem as beyond it the degree of approximating
function output improves to a higher value with only a meagre change in the function output and error. To further investigate into
the problem Figure 3 show the variation of N from 3 to 5. Here one can see that for N=4 and 5 the error is almost zero but with extra
cost of computation time. Hence, N=3 is the optimum degree of approximating function as after it the error reduces at diminishing
rate.
Fig 4: Variation of output variable from FDM solution, LSM solution, and exact solutions as a function of x
y1=3*x/2+1