An Impact of The Small and Large Grid Sizes On Differential Equations
An Impact of The Small and Large Grid Sizes On Differential Equations
An Impact of The Small and Large Grid Sizes On Differential Equations
Abstract
The finite difference technique is oldest numerical method to solve differential equations. Like many differential
equations, Helmholtz differential equation which is used to describe many physical phenomena, has long been
solved using finite difference method. can be described by Helmholtz Differential equations. The solution of the
Helmholtz type differential equations is very important. The information that it belongs together because it tells
one coherent story just knowing a little bit about finite differences through to how to solve differential equations an
especial technique is used, how to implement finite difference method and the tool which is used as generic enough
that will immediately be given a whole new differential equation. The analysis of small to moderate sized presented
with the help of a few examples. The improved finite difference method is presented with examples, the method is
simple, clear, and short the MatLab code is available, the improved finite difference method is suitable and easy to
implement, manually as well as computationally.
1 Introduction
f2 , by connecting point f1 , and f3 , with a line and we, derivatives at the interior mesh point (i,j) are:
will say that the slope of that line will approximate ∂f fi+1,j − fi−1,j
the slope the true slope at f2 , and the reason we do ( )i,j = + O(h2 )
∂x 2h
that is that our points f1 , and f3 are symmetrically ∂f fi,j+1 − fi,j−1
surrounding the point f2 , and the slope connecting ( )i,j = + O(k 2 )
∂y 2k
points f1 and f3 , which is rise over run how much is our
rise it is f3 − f1 and our run that’s the span between Construct a square matrix so that it premultiplies a
x1 , and x3 , so it’s just 2∆x, where ∆x, is the increment vector, we get a vector containing the first order partial
just from x1 , and x2 . derivative. We would like to figure out what the square
matrix looks when premultiply F, get another column
rise f3 − f1
f ′ (x2 ) = = (1) vector that if we multiply would see the derivative of
run 2∆x F that is, in this case, the first-order derivative.
Similarly the derivatives f ′ (x) for at remaining differ-
ent points x1 , x3 , x4 and x5 will be
rise f2 − f0
f ′ (x1 ) = =
run 2∆x
rise f4 − f2
f ′ (x3 ) = =
run 2∆x
′ rise f5 − f3
f (x4 ) = =
run 2∆x
rise f6 − f4
f ′ (x5 ) = =
run 2∆x
This technique is difficult when considering several
points, which is usual practice to get accurate solution
of the differential equations in that case above method Fig. 2: The derivative of a function goemetricaly pre-
will be cumbersome, to be incorporated, we need to sented at any prescribed point
change strategy;
2 f −f
0
f1 2∆x
f
f 3 1
−f
2 2∆x
f4 −f2
? f3 = 2∆x
f5 −f3
f4
2∆x
f5 f6 −f4
2∆x
4 Improved Finite Difference Scheme The Equation 19 is matrix equation, and boundary
The last one is simpler because we had a simple values are not discretized in the matrix, so the matrix
differential equation it does get more complicated and is simply a raw matrix equation in standard form. We
tedious especially, multiple coupled sets of differential have to incorporate boundary values, the first thing we
equations or pde to solve, so it should be in a manner, want to do is the 1st and last rows, these are the areas
that could implement on MatLab code, working it where we want to force all the values zero, which means
is rather specific to solve that single equation, this we are throwing out the finite difference equation that
new method is much more generic, and can rapidly had written for the 1st and the 11th point, we just
solve different differential equations or different sets of throw them out, and make them all zeros, after that
differential equations, for the small to moderate size we will go into the same rows, and we put a 1 (one)
problem, this is an approved way of implementing the in the diagonal position, then we will go to the last
finite difference method column which had all zeros will insert our boundary
values that is the first point we are forcing value 1, and
y(x) = [y], d/(dx)y(x) = [Dx ], d2 /(dx2 )y(x) = [Dx2 ] then the last point forcing a value of 5.
(13)
Equation 13 takes form;
[Dx2 ][y] − 3[Dx ][y] + 2[y] = 0 (14)
The unknown function of x becomes column vector,
and everything operating y becomes a square matrix,
term by term, and write everything in matrix form,
above Equation 14 is the matrix form of an equation,
but we want to write in terms of a standard form that
is AX = B, for that (20)
([Dx2 ] − 3[Dx ] + 2I)[y] = 0. (15)
Standard form is (y1 , y2 , y3 , y4 , y5 , y6 , y7 , y8 , y9 , y10 , y11 )
[A][y] = 0, (16) = (1.0, 1.6, 2.5, 3.9, 6.3, 10.0, 15.7, 24.1, 35.1, 41.8, 5.0)
where
[A] = ([Dx2 ] − 3[Dx ] + 2I). (17) 4.1 Case-II
This is a way to calculate the square matrix A the sum In this case, the grid size is chosen as ∆x = 0.25.
is an algebraic combination of three matrices, with all Solving the Equation(06), so let us solve this using
same size matrices, what we have to do we will change N = 21 uniform grid points, and spacing ∆x then;
Equation 17 into one line MatLab code i.e.
(xb − xa ) (5 − 0)
[A] = ([Dx2 ] − 3[Dx ] + 2I) = DX2 − 3DX + 2I. (18) ∆x = = = 0.25,
(N − 1) (21 − 1)
This equation is so generic, this becomes very sim- substituting ∆x = 0.25 into the finite difference equa-
ple and rapid to change this matrix for any differential tion Equation(8), which gives
equation, we are solving we would just change it as one
line of code, and that’s neat. Here in this method, we
1 3 2
start direct matrix Equation 18, + y( i − 1) + 2 − yi
(0.25) 2 2(0.25) (0.25)2
1 3
+ − y( i + 1) = 0 (21)
(0.25)2 2(0.25)
(26)
4.3 Cale-IV
The different boundary values y(0)= 1 ”and” y(1)=1
are considered in addition to the grid size ∆x = 0.05.
(23)
4.2 Case-III Fig. 5: The 1-D line divided into 20 equal sub-intervals
In this case, the boundary values y(0)=1 and y(5)=2.5
Solving the Equation 06, so let us solve this using
are chosen in addition to the grid size ∆x = 0.125.
N=21 uniform grid points, and spacing ∆x then;
This grid-size is illustrated in Figure 4.
∆x = (xb − xa )/(N − 1) = (1 − 0)/(21 − 1) = 0.05,
substituting ∆x = 0.05 into the finite difference equa-
tion Equation(8), which gives
Fig. 4: The 1-D line divided into 20 equal sub-intervals (1/(0.05)2 + 3/(2.(0.05)))y( i − 1) + (2 − 2/(0.05)2 )yi
+ (1/(0.05)2 − 3/(2.(0.05)))y( i + 1) = 0 (27)
and
6 Conclusion
The improved finite difference method is tested, which
is specially designed for the hard type of differential
equations, and system of differential equation as well
pde, in matrix oriented form, and how it is built
and assembled, this approach converts the differential
equation into MatLab Codes which makes the hard
type of differential equation(s), easier to be evaluated
as presented. In the last session, the comparison of
different grid sizes and different boundary value prob-
lems was tested and found that small grid sizes are
usually the more accurate, but of course, that needs
more calculation, so there is a typical trade-off, we can
improve our accuracy but it requires more calculations
which probably requires more simulation, more time,
and more memory.
References
[1] I. Singer and E. Turkel, “High-order finite difference meth-
ods for the Helmholtz equation,” Computer Methods in
Applied Mechanics and Engineering, vol. 163, no. 1, Art.
no. 1, 1998.