comparing numerical methods for solving the fisher equation

49
Lappeenranta-Lahti University of Technology LUT School of Engineering Science Computational Engineering and Technical Physics Technomathematics Ibrahim Khalifa COMPARING NUMERICAL METHODS FOR SOLVING THE FISHER EQUATION Master’s Thesis Examiners: Professor Heikki Haario Professor Lassi Roininen Supervisor: Professor Heikki Haario

Upload: others

Post on 28-Oct-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Comparing Numerical Methods for Solving the Fisher Equation

Lappeenranta-Lahti University of Technology LUTSchool of Engineering ScienceComputational Engineering and Technical PhysicsTechnomathematics

Ibrahim Khalifa

COMPARING NUMERICAL METHODS FOR SOLVING THEFISHER EQUATION

Master’s Thesis

Examiners: Professor Heikki HaarioProfessor Lassi Roininen

Supervisor: Professor Heikki Haario

Page 2: Comparing Numerical Methods for Solving the Fisher Equation

ABSTRACT

Lappeenranta-Lahti University of Technology LUTSchool of Engineering ScienceComputational Engineering and Technical PhysicsTechnomathematics

Ibrahim Khalifa

Comparing Numerical Methods for Solving the Fisher Equation

Master’s Thesis

2020

49 pages.

Examiners: Professor Heikki HaarioProfessor Lassi Roininen

Keywords: Fisher’s equation, Finite Difference Methods, The Method of Lines

This thesis provides a comparison of results from Finite Difference Methods, pdepe solverand the Method of Lines when solving the Fisher equation and the heat equation. We studythe Fisher equation, which is an example of the parabolic equation and the heat equationas a special case of the Fisher equation. We compute the numerical solutions of thetwo parabolic equations using the FDMs, the pdepe MATLAB solver and the MOLs andcompare their results with the analytical solutions at different times. Finally the CPU timeand the accuracy were computed and presented when solving these parabolic equations.

Page 3: Comparing Numerical Methods for Solving the Fisher Equation

PREFACE

I would like to thank my supervisor Professor Heikki Haario for his continuous supportand encouragement during the course of this project. His valuable contribution to thesuccess of this study cannot be quantified. Many thanks to Nosiba Elfadel for her supportand cooperation during this work. I also want to thank my parents and everyone whohelped me and encouraged me to finish this project.

Lappeenranta, June 25, 2020

Ibrahim Khalifa

Page 4: Comparing Numerical Methods for Solving the Fisher Equation

4

CONTENTS

1 Introduction 61.1 Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.3 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.4 Structure of the thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2 Analytical Solutions of the Parabolic Equations 92.1 Analytical solution of the Fisher equation . . . . . . . . . . . . . . . . . 9

2.1.1 Dimensional analysis . . . . . . . . . . . . . . . . . . . . . . . . 92.2 Analytical solution of the heat equation . . . . . . . . . . . . . . . . . . 15

3 Finite Difference Methods 183.1 Taylor’s theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.2 Finite difference approximations . . . . . . . . . . . . . . . . . . . . . . 183.3 The heat equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.3.1 Explicit method . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.3.2 Implicit method . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3.4 Fisher’s equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.4.1 Explicit FD method . . . . . . . . . . . . . . . . . . . . . . . . . 233.4.2 A Semi implicit FD method . . . . . . . . . . . . . . . . . . . . 24

3.5 The Method of Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.5.1 Five point approximations . . . . . . . . . . . . . . . . . . . . . 26

4 MATLAB’s pdepe Function 274.1 The MATLAB pdepe solution of the Fisher equation . . . . . . . . . . . 284.2 The MATLAB pdepe solution of the heat equation . . . . . . . . . . . . 30

5 Numerical Experiments 335.1 Fisher’s equation results . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.1.1 Explicit FDM results . . . . . . . . . . . . . . . . . . . . . . . . 335.1.2 Semi Implicit FDM results . . . . . . . . . . . . . . . . . . . . 355.1.3 The Method of Lines results . . . . . . . . . . . . . . . . . . . . 365.1.4 pdepe solver results . . . . . . . . . . . . . . . . . . . . . . . . 385.1.5 Comparing the CPU time and the accuracy . . . . . . . . . . . . 40

5.2 The heat equation results . . . . . . . . . . . . . . . . . . . . . . . . . . 40

6 Discussion and Conclusions 47

Page 5: Comparing Numerical Methods for Solving the Fisher Equation

5

LIST OF ABBREVIATIONSASD Accurate Space DerivativeBCs Boundary ConditionsDEs Differential EquationsEFDM Explicit Finite Difference MethodFD Finite DifferenceFDM Finite Difference MethodFDMs Finite Difference MethodsFEM Finite Element MethodIC Initial ConditionIFDM Implicit Finite Difference MethodIVP Initial Value ProblemMOL Method of LinesODE Ordinary Differential EquationODEs Ordinary Differential EquationsPDE Partial Differential EquationPDEs Partial Differential EquationsRDE Reaction Diffusion Equation

Page 6: Comparing Numerical Methods for Solving the Fisher Equation

6

1 Introduction

In explaining a wide variety of natural phenomena undergoing transition, differentialequations (DEs) play a major role. Partial and ordinary differential equations occur indifferent applications like fluid flow, mechanical processes, image processing, earth sci-ences, physics, and mathematical finance [1]. Mathematicians have studied the essence ofthose equations for many years, and there are many well-developed methods for comput-ing the solutions of the DEs. For a given DE, the analytical solution is usually preferablebut many of them can not be resolved exactly by using analytical methods. It is importantto establish the numerical methods in order to solve differential equations in this case.However, there’s a growing demand today for simpler and more effective approachesdue to the increasing demand of applications [1]. In science and engineering, a signifi-cant number of basic physical phenomena also are modelled using nonlinear PDEs. Largenumber of researchers have applied analytical and computational methods to get solutionsto the nonlinear differential equations.

Finite Difference Methods, The Method of Line (MOL) and Finite Element Method(FEM), are among the main numerical techniques for solving PDEs. There are otherapproaches also, such as the Crank-Nicolson method, Monte Carlo Methods, and so on.In this thesis we employ some numerical methods for solving PDEs in particular, theFisher equation and the heat equation. Fisher’s equation is PDE with nonlinear term.Fisher’s equation has been studied first by R. A. Fisher in propagation of a gene withina population [2]. It’s also known as Fisher-Kolmogorov equation, and Fisher-KPP equa-tion (FKPP). Fisher’s equation is special case of reaction diffusion equation (RDE) andit’s useful in applications like biological phenomena [4], physical, chemical reaction pro-cesses, heat and mass transfer [80], optics, and combustion [3]. Many RDEs have travel-ling wave fronts that play a key role in understanding physical, chemical and biologicalphenomena [10], [11], [12]. Consider the following reaction-diffusion equation:

ut = (D(x, u)ux)x + g(x)f(u) (1)

where D(x, u) and f(u) are the diffusivity and source term, respectively. Note that D isdependent on x and u and f on u. Furthermore, the coefficient of f is spatially dependent.Assume that the diffusion coefficient is constant this suggests D(x, u) = k where k is aconstant, and g(x) = 1. Hence,

ut = (kux)x + f(u) (2)

Page 7: Comparing Numerical Methods for Solving the Fisher Equation

7

Given f(u) = αu(1 − u) equation (2) become Fisher’s equation which is heat equationwith additional non-linear term. The following is FKPP equation

∂u

∂t= k

∂2u

∂x2+ αu(1− u) (3)

where k is constant and αu(1− u) is that the nonlinear term its represent logistic growth.Equation (3) has been studied first by R. A. Fisher in propagation of a gene within apopulation [2].

1.1 Related work

In [9] Ablowitz,M.J.and Zeppetella found that the Fisher KPP equation gives explicitsolution for special speed c = ±5/

√6. In [19] Al-Khaled applied the sinc collocation

method to get a solution for such model equation. Abdullaev [14] has described thestability of the travelling wave solutions. In [16] Jenö Gazdag and José Canosa have usedthe ASD method for PDEs to the Fisher equation solution. Logan has studied the FKPPby employing a perturbation technique and found an approximate answer by representingthe answer as a power series [15]. Wang [10] provides the concepts of analytical andexplicit solutions which are related to the general form, also Dag [20] found solutionof Fisher’s equation, he found the answer by B-spline Galerkin technique, also Sloanand Qio [21] discover approximate solutions of Fisher KPP equation by the technigue ofmoving the mesh, in the mean time using element free Galerkin method Ting [21] studiedgeneralized Fisher’s equation. Also modified cubic B-spline collocation approach is hiredthrough Mittal and Jain [21] to take a look at numerical answers of nonlinear Fisher’sequation. In [25] Joseph G and charles R have studied the stochastically perturbed Fisher’sequation, in particular its wave velocity properties. Chandraker found also the solutionof the Fisher equation numerically and Tomasiello discussed the stability in numericalmethod of differential quadrature solutions of wave problems [21].In [26] M. F. K. Abur-Robb looked at the explicit solution of the Fisher quation with3 zeros. This paper [21] implemented polynomial differential quadrature technique tolook at numerical answers of non-linear equations. In [22] Kaysar carried out FD basedmethods to look for numerical answers of the Burger equation and the Fisher equation.

Page 8: Comparing Numerical Methods for Solving the Fisher Equation

8

1.2 Objectives

Our objectives are as follows:

1. To introduce the FDMs, pdepe MATLAB solver and the Method of Lines (MOL).

2. To apply the methods in 1 to solve the Fisher equation and the heat equation.

3. To compare the CPU time and the accuracy of the methods in 1.

1.3 Scope

Our work is focusing on comparing the CPU time and the accuracy of the methods in 1.The comparison is made between the FDMs, pdepe solver and the Method of Lines.

1.4 Structure of the thesis

This thesis contains six sections. In this introductory section we point to the importanceof the differential equations and we define the Fisher equation. This section also containsa literature review of the related work of the Fisher equation, the objectives of the studyand the scope of this work. In section 2 we looked at the analytical solution of the FKPPequation and the heat equation. The homotopy perturbation method is applied to find theanalytical solution of FKPP equation. The method of separation of variables is used tofind analytic solution for the heat equation. In section 3 we introduced the FDMs and itsapproximations and we gave the solution of the heat equation by using the EFDM andIFDM and we solved the Fisher equation using the explicit, semi implicit FDMs and inthe end of the this section the Method of Lines is introduced. In section 4 we introducedthe MATLAB pdepe built in function and used it to solve the Fisher equation and the heatequation. Section 5 discusses the results of the exact solution and the numerical solutionof Fisher’s equation and the heat equation. Finally, Section 6 summarizes the resultsobtained from the methods and describes the possible future work.

Page 9: Comparing Numerical Methods for Solving the Fisher Equation

9

2 Analytical Solutions of the Parabolic Equations

In this section we present in details the analytical solution of the Fisher equation usingthe homotopy perturbation method. The separation of variables technique is employed tofind out an analytical solution for the heat equation

2.1 Analytical solution of the Fisher equation

The reaction-diffusion equation in the commonly known form can be written as shown inthe following formula

∂u

∂t= k

∂2u

∂x2+ +f(u) (4)

where f is a nonlinear function of u. Having the reaction term αu(1 − u), equation(4)gives Fisher’s equation

∂u

∂t= k

∂2u

∂x2+ αu(1− u) (5)

k is the diffusion coefficient and α is the growth rate. u = u(x, t) is the state variable inlocation x and in time t.

2.1.1 Dimensional analysis

To nondimensionalize equation (5) we substitute equation(6) in equation (5). Let

t̂ = αt x̂ = x(αk

)1/2 (6)

Thenx =

(kα

)1/2x̂ (7)

t =1

αt̂ (8)

By substituting (7) and (8) into (5), we get

∂u

∂t= α

∂u

∂t̂,

∂u

∂x=(αk

)1/2∂u

∂x̂

Page 10: Comparing Numerical Methods for Solving the Fisher Equation

10

∂2u

∂x2=

∂x

(∂u∂x

)=∂

∂x

[(αk

)1/2∂u

∂x̂

](9)

=(αk

)1/2 ∂

∂x̂

[(αk

)1/2∂u

∂x̂

](10)

k

∂2u

∂x̂2(11)

Hence equation (5) becomes

α∂u

∂t̂= k(αk

∂2u

∂x̂2

)+ αu(1− u) (12)

Or,∂u

∂t̂=∂2u

∂x̂2+ u(1− u) (13)

Now drop the superscript hat notation, we get

∂u

∂t=∂2u

∂x2+ u(1− u) (14)

The above Fisher equation with the IC

u(0, x) = λ (15)

can be solved using the homotopy perturbation method [24].Now by constructing the homotopy we get

∂u

∂t− ∂u0

∂t= p(∂2u

∂x2− u(1− u)− ∂u0

∂t

)(16)

Suppose that the solution of Fisher’s equation can be written as

u = u0 + pu1 + p2u2 + ... (17)

By substituting (15), (17) into (16) and equating the terms of the same power of p, we get

∂t(u0 + pu1 + p2u2 + ...)− ∂u0

∂t= p( ∂2

∂x2(u0 + pu1 + p2u2 + ...)− (u0 + pu1 + p2u2 + ...)

+ (u0 + pu1 + p2u2 + ...)2 − ∂u0

∂t

)Equate the terms of the p0on both sides we get

∂u0

∂t− ∂u0

∂t= 0, u0(0, x) = λ,

Page 11: Comparing Numerical Methods for Solving the Fisher Equation

11

Equate the terms of the p1 on both sides we get

∂u1

∂t=

∂2u0

∂x2+ u0 − u2

0 , u1(0, x) = 0,

Similarly we compare the terms of p2, p3, ... on both sides we have

∂u2

∂t=

∂2u1

∂x2− 2u0u1 + u1, u2(0, x) = 0,

∂u3

∂t=

∂2u2

∂x2− 2u0u2 − u2

1 + u2, u3(0, x) = 0,

∂u4

∂t=

∂2u3

∂x2− 2u0u3 − 2u1u2 + u3, u4(0, x) = 0,

...

By solving the above system of equations, we obtain

∂u0

∂t− ∂u0

∂t= 0 and u(0, x) = λ =⇒ u0(t, x) = λ

∂u1

∂t=

∂2u0

∂x2+ u0 − u2

0

=∂2λ

∂x2+ λ− λ2

By integrating the both sides we obtain

u1(t, x) = λ(1− λ)t,

∂u2

∂t=

∂2u1

∂x2− u0u1 + u1(1− u0)

=∂2u1

∂x2− u0u1 − u0u1 + u1

=∂2

∂x2(λ(1− λ)t)︸ ︷︷ ︸

=0

−2λ(λ(1− λ)t) + λ(1− λ)t

= −2λ2(1− λ)t+ λ(1− λ)t

Page 12: Comparing Numerical Methods for Solving the Fisher Equation

12

Therefore, integrating the both sides we obtain

u2(t, x) = −2λ2(1− λ)t2

2+ λ(1− λ)

t2

2

= (1− λ)(λ− 2λ2)t2

2!

= λ(1− λ)(1− 2λ)t2

2!

∂u3

∂t=∂2u2

∂x2− 2u0u2 − u2

1 + u2

=∂2

∂x2

(λ(1− λ)(1− 2λ)

t2

2!

)︸ ︷︷ ︸

=0

−2λ(λ(1− λ)(1− 2λ)

t2

2!

)

+(λ(1− λ)(1− 2λ)

t2

2!

)2

+ λ(1− λ)(1− 2λ)t2

2!

=λ(1− λ)(−2λ(1− 2λ)

2− λ(1− λ) +

1− 2λ

2

)t2

=λ(1− λ)(

1− 6λ+ 6λ2) t2

2!

By integrating both sides we get

u3(t, x) = λ(1− λ)(1− 6λ+ 6λ2)t3

3!

By doing the same we have

u4(t, x) = λ(1− λ)(1− 2λ)(1− 12λ+ 12λ2)t4

4!,

...(18)

Now by substituting p = 1 in (17) we can express the solution of equation (14) in theform

u = u0 + u1 + u2 + u3 + · · · (19)

Hence, the solution u(t, x) can be as follows

u(t, x) = λ+ λ(1− λ)t+ λ(1− λ)(1− 2λ)t2

2!+ λ(1− λ)(1− 6λ+ 6λ2)

t3

3!

+ λ(1− λ)(1− 2λ)(1− 12λ+ 12λ2)t4

4!+ · · ·

Page 13: Comparing Numerical Methods for Solving the Fisher Equation

13

Therefor, the equation (14) has the following analytic close form solution

u(t, x) =λet

1− λ+ λet(20)

In the following we study the analytic close form solution of equation (5) when k = 1

and α = 6 Therefore, we have

∂u

∂t=∂2u

∂x2+ 6u(1− u) (21)

with the initial conditionu(0, x) =

1

(1 + ex)2(22)

By constructing the homotopy we have

∂u

∂t− ∂u0

∂t= p(∂2u

∂x2− 6u(1− u)− ∂u0

∂t

)(23)

Substituting (22), (17) into (23) and equating the terms of the same power of p, we get

∂t(u0 + pu1 + p2u2 + ...)− ∂u0

∂t= p( ∂2

∂x2(u0 + pu1 + p2u2 + ...)− 6((u0 + pu1 + p2u2 + ...)

+ (u0 + pu1 + p2u2 + ...)2)− ∂u0

∂t

)Equating the terms of the p0on both sides we get

∂u0

∂t− ∂u0

∂t= 0, u0(0, x) =

1

(1 + ex)2,

Equating the terms of the p1on both sides we get

∂u1

∂t=∂2u0

∂x2+ 6(u0 − u2

0)− ∂u0

∂t, u1(0, x) = 0,

Similarly

∂u2

∂t=

∂2u1

∂x2− 12u0u1 + 6u1, u2(0, x) = 0,

∂u3

∂t=

∂2u2

∂x2− 12u0u2 − 6u2

1 + 6u2, u3(0, x) = 0,

...

By solving the above system of equations, we get

∂u0

∂t− ∂u0

∂t= 0 =⇒ u0(t, x) =

1

(1 + ex)2

Page 14: Comparing Numerical Methods for Solving the Fisher Equation

14

∂u1

∂t=

∂2u0

∂x2+ 6(u0 − u2

0)− ∂u0

∂t

=∂2

∂x2

( 1

(1 + ex)2

)+ 6( 1

(1 + ex)2− 1

(1 + ex)4

)− ∂

∂t

( 1

(1 + ex)2

)︸ ︷︷ ︸

=0

=4e2x − 2ex

(1 + ex)2+

12ex + 6e2x

(1 + ex)4

=10ex

(1 + ex)4

By integrating both sides we obtain

u1(t, x) = 10ex(1 + ex)−3t

∂u2

∂t=

∂2u1

∂x2− 12u0u1 + 6u1

=∂2

∂x2

( 10ex

(1 + ex)3t)− 12

(( 1

(1 + ex)2

)( 10ex

(1 + ex)3t))

+ 6( 10ex

(1 + ex)3t)

=(10ex − 70e2x + 40e3x

(1 + ex)5− 120ex

(1 + ex)5+

60ex

(1 + ex)3

)t

=50ex(−1 + 2ex)

(1 + ex)4t

By integrating both sides we get

u2(t, x) = 25ex(−1 + e2x)(1 + ex)−4t2

Doing the same we have

u3(t, x) =125

3(−1 + 7ex − 4e2x)(1 + ex)−5t3,

...(24)

Substituting p = 1 in (17) we obtain

u = u0 + u1 + u2 + u3 + · · · (25)

Page 15: Comparing Numerical Methods for Solving the Fisher Equation

15

Therefore, the solution can be written of the form

u(t, x) =1

(1 + ex)2+

10ex

(1 + ex)3t+

25ex(−1 + e2x)

(1 + ex)4t2+

+125(−1 + 7ex − 4e2x)

3(1 + ex)5t3 + · · ·

Hence the equation (21) has the following the analytic close form solution

u(t, x) =1

(1 + ex−5t)2(26)

Thus, applying the homotopy perturbation technique to the Fisher equation

∂u

∂t=∂2u

∂x2+ αu(1− u) (27)

gives the following exact close form solution

u(t, x) =1

[1 + exp(√

α6x− 5α

6t)]2

x ∈ [−∞,∞], and t ∈ [0, τ ] (28)

where α is a constant and c = 5√α/6.

2.2 Analytical solution of the heat equation

Consider an IVP for the heat equation :

ut = kuxx, 0 ≤ x ≤ 1, t > 0 (29)

with

BCs : u(t, 0) = u(t, 1) = 0 ∀t > 0 (30)

IC : u(0, x) = f(x) ∀x ∈ [0, 1] (31)

Let us attempt to find the solution of equation (29) that satisfies the BCs by using theseparation of variables method. We guess that we have solutions on the form

u(x, t) = X(t)T (t) (32)

Page 16: Comparing Numerical Methods for Solving the Fisher Equation

16

X(t) and T (t) depend only on x and t. Substituting (32) back into (29), we get

X ′′(x)

X(x)=

1

k

T ′(t)

T (t)(33)

However, the above equation is equal to some constant value −λ.

X ′′(x) + λX(x) = 0, (34)

T ′(t) + kλT (t) = 0. (35)

The BCs imply that u(t, 0) = 0 = X(0)T (t) and u(t, 1) = 0 = X(1)T (t).

Then, X(x) must satisfyX(0) = 0 and X(1) = 1

with T (t) not equal to zero for t > 0. For three distinct cases of λ we get

I. λ < 0 :

X(x) = C1e√−λx + C2e

√−λx

=⇒ C1 = C2 = 0 which only provides a trivial solution.

II. λ = 0 :

X(x) = C1x+ C2

Again, from the boundary conditions C1 = C2 = 0, one gets only trivial solutionof the problem.

III. λ > 0 :

X(x) = C1 cos(√λx) + C2 sin(

√λx)

By substituting the BCs ,we obtain

X(0) = C1 = 0

X(1) = C2 sin(√λ) = 0⇒ sin(

√λ) = 0⇒ λn = (nπ)2, n = 1, 2, ...

Therefore,X(x) = Cn sin(nπx)

Page 17: Comparing Numerical Methods for Solving the Fisher Equation

17

Now, the second equation for T (t) takes the form:

T ′(t) + k(πn)2 · T (t) = 0⇒ T (t) = Bn exp(−k(nπ)2t),

where Bn is constant.

Hence, the solution equation (29) can be written as

u(t, x) =∞∑n=1

An sin(nπx) exp(−k(nπ)2t), An is const. (36)

An can be determined by the IC

u(x, 0) = f(x),

f(x) can be written as a Fourier series, as follows

f(x) =∞∑n=1

Fn sin(nπx) =∞∑n=1

An sin(nπx)

An = Fn = 2

1∫0

f(η) sin(nπη)dη

Therefore, the general solution is

u(t, x) =∞∑n=1

(2

1∫0

f(η) sin(nπη)dη)

sin(nπx

)exp

(− k(nπ)2t

). (37)

Page 18: Comparing Numerical Methods for Solving the Fisher Equation

18

3 Finite Difference Methods

The aim of this method is to create a numerical scheme. It’s based on differential operatorapproximations. In this section the FDMs are discussed and used to solve two parabolicequations. The MOL method is also introduced at the end of the section.

3.1 Taylor’s theorem

Let u(x) which is defined over the interval (a, b) have n continuous derivatives. Then fora < x0, x0 + h < b

u(x0 + h) = u(x0) + hux(x0) + h2uxx(x0)

2!+ ...+ hn−1u(n−1)(x0)

(n− 1)!+O(hn) (38)

where,

ux =du

dx, uxx =

d2u

dx2, ..., u(n−1) =

dn−1u

dxn−1.

ux(x0) is the derivative of u w.r.t x and O(hn) its the order of h to n.

This theorem states that if the value of u and its derivatives values at point x0 is knownthen equation (38) can be written at the point x0 + h. If we cancel O(h) in (38) we obtainan approximation of u(x0 + h). The term O(hn) is related to the error order.

3.2 Finite difference approximations

Now, we are constructing common FD approximations for common partial derivatives.let us take u = u(x, t) and approximate the partial derivatives of u with reference to x.Considering t is constant, u become a function of x and so in equation (38) and replacethe step size h by ∆x hence (38) becomes,

u(t, x0+∆x) = u(t, x0)+(∆x)ux(t, x0)+(∆x)2

2!uxx(t, x0)+...+

(∆x)n−1

(n− 1)!un−1(t, x0)+O(∆x)n

(39)Truncating equation (39) to O(∆x)2 gives,

u(t, x0 + ∆x) = u(t, x0) + (∆x)ux(t, x0) +O(∆x)2 (40)

Page 19: Comparing Numerical Methods for Solving the Fisher Equation

19

Rearranging (40) gives,

ux(t, x0) =u(t, x0 + ∆x)− u(t, x0)

∆x− O(∆x)2

∆x

Hence,

ux(t, x0) =u(t, x0 + ∆x)− u(t, x0)

∆x−O(∆x) (41)

When using numerical schemes to solve PDEs we’re restrained to a grid of discrete xvalues, x1, x2, x3, ..., xN and discrete t levels, tn, n = 0, 1, 2, ... . Assume a constant gridspace, so that ∆x = xi+1 − xi. Evaluating equation (41) at the point (tn, xi) gives,

ux(tn, xi) =u(tn, xi+1 + ∆x)− u(tn, xi)

∆x−O(∆x) (42)

For simplicity we will use the notation Uni for evaluating u at the point (tn, xi). Now

using this new notation and dropping the error term O(∆x), equation (42) becomes,

ux(tn, xi) =Uni+1 − Un

i

∆x(43)

Equation (43) is forward difference approximation to ux(tn, xi) of order one. Substitute−∆x instead of ∆x in (40) we get,

u(t, x0 −∆x) = u(t, x0)− (∆x)ux(t, x0) +O(∆x)2 (44)

Rearranging (44) as previously we get

ux(tn, xi) =Uni − Un

i−1

∆x(45)

Equation (45) is called backward difference approximation to ux(tn, xi) of order one. Ourequations (43) and (45) are of the first order but we can increase the order by taking moreterms in the Taylor expansion. Many of the partial differential equations contains higherorder derivatives terms so we have to derive their approximations. We shall restrict ourfocus to the PDEs of second order i.e. uxx.

Page 20: Comparing Numerical Methods for Solving the Fisher Equation

20

Approximating (39) to O(∆x)4 gives,

u(t, x0+∆x) = u(t, x0)+(∆x)ux(t, x0)+(∆x)2

2!uxx(t, x0)+

(∆x)3

3!uxxx(t, x0)+O(∆x)4

(46)Substitute −∆x instead of ∆x in (46) we get

u(t, x0−∆x) = u(t, x0)−(∆x)ux(t, x0)+(∆x)2

2!uxx(t, x0)− (∆x)3

3!uxxx(t, x0)+O(∆x)4

(47)Adding (46) and (47) gives,

u(t, x0 + ∆x) + u(t, x0 −∆x) = 2u(t, x0) + ∆x2uxx(t, x0) +O(∆x)4 (48)

Using our discrete notation, evaluating equation (48) at the point (tn, xi) gives,

Uni+1 + Un

i−1 = 2Uni + ∆x2uxx(t, x0) +O(∆x4) (49)

drop the error term O(∆x4) and rewrite equation 49, we obtain

uxx(t, x0) =Uni+1 − 2Un

i + Uni−1

∆x2(50)

Equation (50) is symmetric FD approximation of the second order. We can also deriveFD approximations with respect to t in the same way as we did on x.

3.3 The heat equation

The diffusion equation (or heat equation) is important for scientific fields and engineeringproblems. Its considered as special case of the Fisher equation when taking f(u) = 0.

Considerut = kuxx + f(u)︸︷︷︸

=0

0 < x < 1, 0 < t < τ (51)

where u = u(x, t) and k is constant. Having the IC

u(0, x) = f(x) (52)

and the following BCsu(t, 0) = g1(t)

u(t, 1) = g2(t)(53)

Page 21: Comparing Numerical Methods for Solving the Fisher Equation

21

The solution of (51), (52) and (53) is to find u(t, x) satisfying the boundary conditions [6].We want to solve the heat equation numerically, so let us first partition the spatial interval[0, 1] and [0, τ ] as follows:

xi = i∆x i = 0, 1, ..., N where1

N= ∆x (54)

tn = n∆t n = 0, 1, ...,M whereτ

M= ∆t (55)

In the following we recall the Finite Difference Approximations in section 3.2 and usethem to solve equation (51) by using the explicit and implicit methods.

3.3.1 Explicit method

The explicit method of finite difference based on the approximation of first derivativeforward difference.

ut(tn, xi) =Un+1i − Un

i

∆t, (56)

and the central difference to second order derivative.

uxx(tn, xi) =Uni+1 − 2Un

i + Uni−1

∆x2, (57)

Substituting (56) and (57) in equation (51) results

Un+1i − Un

i

∆t= k

Uni+1 − 2Un

i + Uni−1

(∆x)2(58)

The temperature at time n + 1 is determined by the temperature at time n, in the explicitfinite difference method. However, solving for Un+1

i in equation (58) we get

Un+1i − Un

i =k∆t

(∆x)2

(Uni+1 − 2Un

i + Uni−1

)(59)

where r =k∆t

(∆x)2

Un+1i = Un

i + r(Uni+1 − 2Un

i + Uni−1

)(60)

Therefore,Un+1i = rUn

i+1 + (1− 2r)Uni + rUn

i−1 (61)

Page 22: Comparing Numerical Methods for Solving the Fisher Equation

22

Equation (61) is known as the explicit FD approximation to the heat equation given inequation (51) [7]. Also we can rewrite equation (61) in the matrix form as

Un+11

Un+12......

Un+1N−1

=

1− 2r r 0 . . . 0

r 1− 2r r 0... . . . . . . . . . ...0 r

0 0 . . . r 1− 2r

Un1 + rUn

0

Un2......

UnN−1 + rUn

N

(62)

3.3.2 Implicit method

To derive the implicit form, we substitute (56) and (50) at time n+ 1 in equation (51), weget

Un+1i − Un

i

∆t= k

Un+1i+1 − 2Un+1

i + Un+1i−1

(∆x)2(63)

Equation (63) can be written as follows

Uni = −rUn+1

i−1 + (1 + 2r)Un+1i − rUn+1

i+1 (64)

where r =k∆t

(∆x)2and i is from 1 to N − 1.

Equation (64) is called the Implicit Method, this method can not be reorganized to achievea simple algebraic formula similar to the explicit method. Although this is an implicitmethod drawback, this method has the benefit of being unconditionally consistent [8].Equation ( 61) can be in the matrix form as follows

1 + 2r −r 0 . . . 0

−r 1 + 2r −r 0... . . . . . . . . . ...0 −r0 0 . . . −r 1 + 2r

Un+11

Un+12......

Un+1N−1

=

Un1 + rUn

0

Un2......

UnN−1 + rUn

N

(65)

Page 23: Comparing Numerical Methods for Solving the Fisher Equation

23

3.4 Fisher’s equation

In the following we want to study Fisher’s equation using a standard explicit and semiimplicit finite difference schemes. The equation is given by

∂u

∂t=∂2u

∂x2+ αu(1− u) (66)

with the BCs and IC

u(t, 0) =1

(1 + e−5t)2, 0 ≤ t ≤ τ, (67)

u(t, 1) =1

(1 + e1−5t)2, 0 ≤ t ≤ τ, (68)

u(0, x) =1

(1 + ex)2, 0 ≤ x ≤ 1. (69)

3.4.1 Explicit FD method

Partition the spatial interval [0, 1] and [0, τ ] as in subsubsection 3.3. Recall (56) and (57)and plug them into (66) we get

Un+1i − Un

i

∆t=Uni+1 − 2Un

i + Uni−1

(∆x)2+ αUn

i (1− Uni ) (70)

The above equation can be written as

Un+1i − Un

i =∆t

(∆x)2

(Uni+1 − 2Un

i + Uni−1

)+ α∆tUn

i (1− Uni ) (71)

Or,

Un+1i = rUn

i−1 + (1− 2r)Uni + rUn

i+1 + α∆tUni (1− Un

i ) (72)

Un+1i = rUn

i−1 + (1− 2r + α∆t− α∆tUni )Un

i + rUni+1 (73)

where r = ∆t(∆x)2

, n ≥ 0, i = 1, 2, ..., N − 1.

We initialize the scheme by

U0N =

1

(1 + ex)2, 0 ≤ x ≤ 1

Page 24: Comparing Numerical Methods for Solving the Fisher Equation

24

The BCs at x = 0, x = 1 are

UM0 =

1

(1 + e−5t)2, 0 ≤ t ≤ τ,

UM1 =

1

(1 + e1−5t)2, 0 ≤ t ≤ τ,

Equation (72) is called explicit FD approximation to the Fisher equation [7]. We canrewrite equation (72) in the matrix form as follows

Un+11

Un+12......

Un+1N−1

=

Q1 r 0 . . . 0

r Q2 r 0... . . . . . . . . . ...0 r

0 0 . . . r QN−1

Un1 + rUn

0

Un2......

UnN−1 + rUn

N

(74)

where,Qi = (1− 2r + α∆t− α∆tUn

i ), i = 1, 2, ...N − 1

3.4.2 A Semi implicit FD method

The domain is also discreetized on a fixed mesh in this method. The [0, 1] space intervaland the [0, τ ] time interval are divided as follows

xi = i∆x i = 0, 1, ..., N where1

N= ∆x (75)

tn = n∆t n = 0, 1, ...,M whereτ

M= ∆t (76)

Here we calculate the derivatives at the time level of n+ 1, but in the explicit FD methodthe derivatives are determined at the time level of n. In this scheme, we use the forwarddifference in time and the central difference in space. In this scheme, the nonlinear termis linearized using the method of lagging. The method of lagging idea is that the solutionis determined at different time levels, for example one is calculated at time step n+1, andthe other is calculated at time step n.

Page 25: Comparing Numerical Methods for Solving the Fisher Equation

25

Consider the Fisher equation

ut = uxx + αu(1− u) (77)

By substituting (56) and central FD approximation at n + 1 and use method of lagginginto the above Fisher equation we get,

Un+1i − Un

i

∆t=Un+1i+1 − 2Un+1

i + Un+1i−1

(∆x)2+ αUn+1

i (1− Uni ) (78)

Un+1i =

∆t

(∆x)2

(Un+1i+1 − 2Un+1

i + Un+1i−1

)+ α∆tUn+1

i (1− Uni ) + Un

i (79)

Or,Un+1i = r

(Un+1i+1 − 2Un+1

i + Un+1i−1

)+ ηUn+1

i (1− Uni ) + Un

i (80)

where,

r =∆t

(∆x)2and α∆t = η (81)

Equation (80) may be expressed as below

AiUn+1i−1 +BiU

n+1i + SiU

n+1i+1 = Di (82)

such that Ai ,Si are constants. Ai = Si = −r and Bi = 1 + 2r − η(1 − Ui). Whenthe whole scheme is formed and the BCs are applied, the matrix for Ax = b where Ais representing a tridiagonal matrix of M × N . The x vector contains the values we arelooking for. Also x, b are vectors , and b contains the all known values.

A =

B1 −r . . . . . . . . . . . . . . .

−r B2 −r . . ....

...... . . . . . . . . . ...

......

. . . . . .. . . . . . −r ...

.... . . . . . . . . −r BN−2 −r . . .

. . . . . . . . . . . . −r BN−1 −r

x =

Un+11

Un+12......

Un+1N−1

Un+1N

, b =

Un1

Un2......

UnN−1

UnN

(83)

Page 26: Comparing Numerical Methods for Solving the Fisher Equation

26

In section 5, we provide the results of the semi-implicit scheme for the solution of theFisher equation to confirm the theoretical results of the scheme. The MATLAB softwareis used to program the Fisher equation and to generate numerical results and graphs.

3.5 The Method of Lines

This Method is a numerical method for solving PDEs. The simple concept is to discretizein space only and use an ODE package to solve the resulting ODEs in time. Discretizationcan be done by using FD approximations, but more research is currently going on to usenew techniques, such as Galerkin or collocation methods. In this method we discretizethe space using the five point FD approximations.

3.5.1 Five point approximations

Consider a square grid in 1-dimension, the five point stencil of a point x in the grid is

(x− 2∆x, x−∆x, x, x+ ∆x, x+ 2∆x)

The first and second approximations of a function u at the point x can be determined usingthe following formulas

ux =−u(x+ 2∆x) + 8u(x+ ∆x)− 8u(x−∆x) + u(x− 2∆x)

12∆x

uxx =−u(x+ 2∆x) + 16u(x+ ∆x)− 30u(x) + 16u(x−∆x)− u(x− 2∆x)

12(∆x)2

it is called a five-point approximations, because it is derived from the Lagrange polyno-mials for the five points (x − 2∆x, x − ∆x, x, x + ∆x, x + 2∆x). In section 5 we givethe solution of the Fisher equation and the heat equation by using the MOL method andcompare the results with the exact solution.

Page 27: Comparing Numerical Methods for Solving the Fisher Equation

27

4 MATLAB’s pdepe Function

MATLAB has a built in function called pdepe that can solve PDEs with initial and bound-ary values. It solves parabolic and elliptic PDEs in space x and time t. Its built on FDMsand the FEM is used in the PDE Toolbox. The pdepe function solves PDEs of the follow-ing form

c(x, t, u,∂u

∂x)∂u

∂t= x−m

∂x

(xmf(x, t, u,

∂u

∂x))

+ s(x, t, u,∂u

∂x)

where m = 0, 1 or 2; f and s are given functions of x, t, u and ∂u∂x

; c(x, t, u, ∂u∂x

) is adiagonal matrix with identically zero or positive coefficients.

with the IC and the BCsu(t = 0, x) = u0(x)

p(x, t, u) + q(x, t)f(x, t, u,∂u

∂x) = 0

where p is a function depending on x, t, u and q is a function depending on x, t.

In order to solve any parabolic or elliptic PDEs system using pdepe solver we need tospecify the following steps refer to Matlab help:

1. Write the PDEs as follows

c(x, t, u,∂u

∂x)∂u

∂t= x−m

∂x

(xmf(x, t, u,

∂u

∂x))

+ s(x, t, u,∂u

∂x)

2. Write the code for the PDE

function [c, f, s] = pdefunction(t, x, u,DuDx)

where x is the position, t represent the time, u is dependent variable and DuDx isux which is the first derivative of u with respect to x.

3. Write the code for the IC

function u0 = pdeinitial(x)

which specifies the function u(0, x) = f(x).

Page 28: Comparing Numerical Methods for Solving the Fisher Equation

28

4. Write the code for the BCs

[pl, ql, pr, qr] = pdeboundary(t, xl, ul, xr, ur)

In the function pdeboundary, pl and ql represent the left BCs, and pr and qr repre-sent the right BCs.

5. Select mesh points and time steps. For instance

x = linspace(0, 1, 11)

t = linspace(0, 0.1, 101)

6. Apply the PDE solver

m = 0, 1or 2; sol = pdepe(m,@pdefunction,@pdeinitial,@pdeboundary, x, t, options)

In the following the steps to solve the Fisher equation and heat equation when using theMATLAB pdepe function are given in details. Fisher’s equation solution is given in Fig.1and the heat equation solution which is special case of the Fisher equation is shown whens(x, t, u, ∂u

∂x) = 0 in Fig.2.

4.1 The MATLAB pdepe solution of the Fisher equation

This part gives in details the solution steps of the Fisher equation (66) using the built infunction pdepe.Firstly, write Fisher’s equation

∂u

∂t=

∂2u

∂x2+ αu(1− u)

=∂

∂x(∂u

∂x) + αu(1− u)

in the form of PDEs in step 1, this gives

c∂u

∂t= x−m

∂x(xmf) + s

Comparing the above equation with the Fisher’s equation

(1)∂u

∂t=

∂x(∂u

∂x) + αu(1− u)

Page 29: Comparing Numerical Methods for Solving the Fisher Equation

29

this means

m = 0, c(t, x) = 1, f(t, x, u,∂u

∂x) =

∂u

∂xand s(t, x, u,

∂u

∂x) = αu(1− u)

Write the initial conditionu0 =

1

(1 + exp(x))2

and the boundary conditions

u(t, 0) =1

(1 + e−5t)2

u(t, 1) =1

(1 + e1−5t)2

takes the following forms

pl(t, xl, u) + ql(t, xl)f(t, xl, u,∂u

∂x) = 0

pr(t, xr, u) + qr(t, xr)f(t, xr, u,∂u

∂x) = 0

By comparing the boundary conditions with the above forms we get

pl(t, xl, u) = ul −1

(1 + e−5t)2

ql = 0

pr(t, xr, u) = ur −1

(1 + e1−5t)2

qr = 0

Note that ul indicates the u at the left boundary and ur indicates the u in the right boundaryStep five take the mesh pointsFor instance

x = linspace(0, 1, 30) taking 30 meshes for (xmesh)

t = linspace(0, 2, 10) taking 30 meshes for (tmesh)

In the last solve using the function pdepe

m = 0; sol = pdepe(m,@pdefunction,@pdeinitial,@pdeboundary, x, t, options)

where @pdefunction, @pdeinitial and @pdeboundary are the M-files for our PDE, the ICand the BCs respectively.The following is the mesh plot solution to the Fisher Equation

Page 30: Comparing Numerical Methods for Solving the Fisher Equation

30

Figure 1. pdepe function solution of the Fisher equation (66) computed with α = 6,∆x =0.1, and ∆t = 0.001.

4.2 The MATLAB pdepe solution of the heat equation

The heat equation is a specific case of Fisher’s equation, given the term αu(1 − u) = 0.In the following we give the solution steps of the heat equation using the built in functionpdepe. Write the heat equation

∂u

∂t=

∂2u

∂x2

=∂

∂x(∂u

∂x)

in the form of PDEs this gives

c∂u

∂t= x−m

∂x(xmf) + s

comparing the above equation with the heat equation

(1)∂u

∂t=

∂x(∂u

∂x)

Page 31: Comparing Numerical Methods for Solving the Fisher Equation

31

this meansm = 0, c(t, x) = 1,

f(t, x, u,∂u

∂x) =

∂u

∂x,

s(t, x, u,∂u

∂x) = 0.

The only difference from the Fisher equation is that s(t, x, u,∂u

∂x) = 0

Now write the ICu0 =

1

(1 + exp(x))2

and the BCs

u(t, 0) =1

(1 + e−5t)2

u(t, 1) =1

(1 + e1−5t)2

takes the following forms

pl(t, xl, u) + ql(t, xl)f(t, xl, u,∂u

∂x) = 0

pr(t, xr, u) + qr(t, xr)f(t, xr, u,∂u

∂x) = 0

By comparing the boundary conditions with the above forms we get

pl(t, xl, u) = ul −1

(1 + e−5t)2

ql = 0

pr(t, xr, u) = ur −1

(1 + e1−5t)2

qr = 0

Note that ul, ur indicates respectively the left and the right boundary conditions.Take the mesh pointsFor example take

x = linspace(0, 1, 30) taking 30 meshes for (xmesh)

t = linspace(0, 2, 10) taking 30 meshes for (tmesh)

In the last solve using the function pdepe

m = 0; sol = pdepe(m,@pdefunction,@pdeinitial,@pdeboundary, x, t, options)

Page 32: Comparing Numerical Methods for Solving the Fisher Equation

32

where @pdefunction, @pdeinitial and @pdeboundary are the M-files for our PDE, the ICand the BCs respectively.

Figure 2. pdepe function Solution of the equation (66) computed with f(u) = s = 0,∆x =0.1, and ∆t = 0.001.

Page 33: Comparing Numerical Methods for Solving the Fisher Equation

33

5 Numerical Experiments

This section compare the numerical results and the analytical solutions of the Fisher’sequation and the heat equation. We present the exact and the numerical solutions of theFisher equation and the heat equation using the explicit and implicit FDMs, the method oflines and the pdepe MATLAB solver. Also we compare the CPU time and the accuracy ofthese methods when solving the Fisher equation and the heat equation. In the all figureswe are taking the distance x ∈ [0, 1] and the time t ∈ [0, 0.1].

5.1 Fisher’s equation results

Recall the Fisher equation∂u

∂t=∂2u

∂x2+ αu(1− u)

with boundary and initial conditions

u(t, 0) =1

(1 + e−5t)2, 0 ≤ t ≤ τ,

u(t, 1) =1

(1 + e1−5t)2, 0 ≤ t ≤ τ,

u(0, x) =1

(1 + ex)2, 0 ≤ x ≤ 1.

5.1.1 Explicit FDM results

Table 1 gives the EFDM solution and the exact solution of the Fisher equation and the ab-solute error between the two. The graphs represents the comparison between the explicitFDM solution and the exact solution of Fisher’s equation in different times.

Page 34: Comparing Numerical Methods for Solving the Fisher Equation

34

Table 1. The Explicit FDM solution and the exact solution of the Fisher equationwhen x ∈ [0, 1] and t ∈ [0, 0.1] at the final time t=0.1.

Distance x Approx. Solution Exact Solution Absolute Error0 0.3875 0.3875 00.1 0.3584 0.3584 5.3785e-050.2 0.3299 0.3300 9.9794e-050.3 0.3022 0.3023 1.3615e-040.4 0.2754 0.2756 1.6145e-040.5 0.2498 0.2500 1.7444e-040.6 0.2255 0.2256 1.7375e-040.7 0.2025 0.2026 1.5779e-040.8 0.1810 0.1811 1.2470e-040.9 0.1610 0.1611 7.2620e-051 0.1425 0.1425 0

(a) (b)

(c) (d)

Figure 3. Comparison between the results obtained by the explicit FDM Scheme and exact solu-tion at different times : (a) t=0.005; (b) t=0.0490; (c) t=0.08; (d) at the final t=0.1.

Page 35: Comparing Numerical Methods for Solving the Fisher Equation

35

5.1.2 Semi Implicit FDM results

Table 2 gives the semi implicit solution, the exact solution of the Fisher equation and theabsolute error between two. The graphs represents the comparison between the implicitFDM solution and the exact solution Fisher’s equation in different times.

Table 2. The Implicit FDM solution and the exact solution of the Fisher equationwhen x ∈ [0, 1] and t ∈ [0, 0.1] at the final time t=0.1.

Distance x Approx. Solution Exact Solution Absolute Error0 0.3875 0.3875 00.1 0.3585 0.3584 1.0684e-040.2 0.3302 0.3300 1.8115e-040.3 0.3025 0.3023 2.2825e-040.4 0.2759 0.2756 2.5246e-040.5 0.2503 0.2500 2.5690e-040.6 0.2259 0.2256 2.4332e-040.7 0.2029 0.2026 2.1213e-040.8 0.1813 0.1811 1.6247e-040.9 0.1611 0.1611 9.2527e-051 0.1425 0.1425 0

Page 36: Comparing Numerical Methods for Solving the Fisher Equation

36

(a) (b)

(c) (d)

Figure 4. Comparison between the results obtained by the semi implicit FDM Scheme and exactsolution at different times: (a) t=0.005; (b) t=0.0490; (c) t=0.08; (d) at final time t = 0.1

5.1.3 The Method of Lines results

Table 3 gives the MOL solution, the exact solution of the Fisher equation and the absoluteerror between two. The graphs represents the comparison between the MOL solution andthe exact solution of the Fisher equation in different times.

Page 37: Comparing Numerical Methods for Solving the Fisher Equation

37

Table 3. The MOL solution and the exact solution of the Fisher equationwhen x ∈ [0, 1] and t ∈ [0, 0.1] at the final time t=0.1.

Distance x Approx. Solution Exact Solution Absolute Error0 0.3875 0.3875 00.1 0.3591 0.3584 7.1559e-040.2 0.3307 0.3300 6.9152e-040.3 0.3029 0.3023 5.8317e-040.4 0.2761 0.2756 4.9226e-040.5 0.2504 0.2500 4.3369e-040.6 0.2261 0.2256 4.1043e-040.7 0.2031 0.2026 4.2087e-040.8 0.1816 0.1811 4.5476e-040.9 0.1615 0.1611 4.4794e-041 0.1425 0.1425 0

(a) (b)

(c) (d)

Figure 5. Comparison between the results obtained by the explicit FDM Scheme and exact solu-tion at different times: (a) t=0.005; (b) t=0.0490; (c) t=0.08; (d) at the final t=0.1.

Page 38: Comparing Numerical Methods for Solving the Fisher Equation

38

5.1.4 pdepe solver results

Table 4. The pdepe solution and the exact solution of the Fisher equationwhen x ∈ [0, 1] and t ∈ [0, 0.1] at the final time t=0.1.

Distance x Approx. Solution Exact Solution Absolute Error0 0.3875 0.3875 00.1 0.3584 0.3584 8.2098e-070.2 0.3300 0.3300 7.4960e-060.3 0.3023 0.3023 2.1840e-050.4 0.2756 0.2756 3.8433e-050.5 0.2501 0.2500 5.3360e-050.6 0.2257 0.2256 6.2959e-050.7 0.2027 0.2026 6.4103e-050.8 0.1812 0.1811 5.4493e-050.9 0.1611 0.1611 3.2995e-051 0.1425 0.1425 0

Page 39: Comparing Numerical Methods for Solving the Fisher Equation

39

(a) (b)

(c) (d)

Figure 6. Comparison between the results obtained by the pdepe MATLAB solver and exactsolution at different time where ∆x = 0.1, ∆t = 0.001 and (a) t = 0.005; (b) t = 0.0490; (c)t = 0.08; (d) at final time t = 0.1.

Page 40: Comparing Numerical Methods for Solving the Fisher Equation

40

5.1.5 Comparing the CPU time and the accuracy

In the following table we give the CPU time and the accuracy of the methods when solvingthe Fisher equation. In this computation x ∈ [0, 1], t ∈ [0, 0.1],∆x = 0.1 and ∆t =

0.001. The accuracy computed by comparing the numerical solution and the exact solutionusing the L2-norm of the error. The L2-norm is defined as

L2 = ||uexact − ucomputed||2 =

√√√√( n∑i=1

|uexacti − ucomputed

i |2

N

)where uexact ,ucomputed represents the exact and the numerical solution and N is the meshnodes.

Explicit FDM Semi Implicit FDM MOL Pdepe Solver

CPU time in seconds 0.0023 0.0111 0.1385 0.2107

L2− norm 0.0026 0.0037 0.0113 0.0015

The above table shows that the all methods gives accurate results in short CPU time. Wesee that the pdepe solver gives the smallest error compare to the other methods. Theexplicit FDM gives good result in smallest time compare to the other methods.

5.2 The heat equation results

In this part we solve the heat equation :

ut = kuxx, 0 ≤ x ≤ 1, t > 0 (84)

with the boundary and initial condition

u(t, 0) = u(t, 1) = 0 ∀t > 0 (85)

u(0, x) = f(x) ∀x ∈ [0, 1] (86)

for which the exact solution is given as

u(t, x) = exp(−4π2t) · sin(2πx) (87)

The solutions of the equation (84) have been obtained with the above initial and boundaryconditions by using the explicit, implicit FDM, the Method of Lines and the pdepe solver.

Page 41: Comparing Numerical Methods for Solving the Fisher Equation

41

The following figures are the comparison between the exact and the numerical resultsof these methods. We mainly compute the error for these methods when ∆t = 0.001

and ∆t = 0.01. In the semi implicit method we found that considering ∆x = 0.1 with∆t = 0.001 and 0.01 gives large error compare to the explicit method. Therefore westudied further when ∆x = 0.01with ∆t = 0.001 and ∆t = 0.00001 and this gives bettererror up to O(10−3) and O(10−4) respectively.

(a) (b)

(c) (d)

Figure 7. Comparison between the results obtained by the explicit FDM Scheme and exact so-lution when x ∈ [0, 1], t ∈ [0, 0.1] with ∆x = 0.1 and ∆t = 0.001 in the upper figures and∆x = 0.1 and ∆t = 0.01 in the lower figures

Page 42: Comparing Numerical Methods for Solving the Fisher Equation

42

(a) (b)

(c) (d)

Figure 8. Comparison between the results obtained by the implicit FDM Scheme and exact so-lution when x ∈ [0, 1], t ∈ [0, 0.1] with ∆x = 0.1 and ∆t = 0.001 in the upper figures and∆x = 0.1 and ∆t = 0.01 in the lower figures

Page 43: Comparing Numerical Methods for Solving the Fisher Equation

43

(a) (b)

(c) (d)

Figure 9. Comparison between the results obtained by the implicit FDM Scheme and exact so-lution when x ∈ [0, 1], t ∈ [0, 0.1] with ∆x = 0.01 and ∆t = 0.001 in the upper figures and∆x = 0.01 and ∆t = 0.01 in the lower figures

Page 44: Comparing Numerical Methods for Solving the Fisher Equation

44

(a) (b)

(c) (d)

Figure 10. Comparison between the results obtained by the implicit FDM Scheme and exactsolution when x ∈ [0, 1], t ∈ [0, 0.1] with ∆x = 0.01 and ∆t = 0.001 in the upper figures and∆x = 0.01 and ∆t = 0.00001 in the lower figures

Page 45: Comparing Numerical Methods for Solving the Fisher Equation

45

(a) (b)

(c) (d)

Figure 11. Comparison between the results obtained by the pdepe solver and exact solution whenx ∈ [0, 1], t ∈ [0, 0.1] with M = 11, N = 101 in the upper figures and M = 100, N = 100 inthe lower figures.

Page 46: Comparing Numerical Methods for Solving the Fisher Equation

46

In the following table we give the CPU time and the accuracy of the methods when solvingthe heat equation. In this computation we are taking x ∈ [0, 1], t ∈ [0, 0.1],∆x = 0.1 and∆t = 0.01. The accuracy computed by comparing the numerical solution and the exactsolution using the l2-norm of the error.

Explicit FDM Implicit FDM MOL Pdepe Solver

CPU time in seconds 0.001 0.0161 0.113 0.217

L2− norm 0.3337 0.0368 0.0048 0.0540

It can be seen from the table above that all methods give good results in short CPU timeand with small errors. We see that the Method of Lines gives the smallest error compareto the other methods. The IFDM and the pdepe have the same order of the error. TheEFDM gives a larger error than other methods, but it was the fastest method in terms of

the CPU time. Also we found that the explicit method is stable if 0 < r =∆t

∆x2≤ 0.5

and unstable if r > 0.5. Taking ∆x = ∆t = 0.01 the explicit FDM fails for producingresults but the implicit gives results. By comparing the explicit and the implicit methodswe found that the explicit method gives better error than the implicit when ∆x = 0.1 and∆t = 0.001. The implicit method gives the same result of the implicit when ∆x = 0.01

,∆t = 0.001 and better results upto O(h−4) when ∆x = 0.01 and ∆t = 0.00001. Inaddition to that the implicit method is always stable.

Page 47: Comparing Numerical Methods for Solving the Fisher Equation

47

6 Discussion and Conclusions

This thesis uses the finite difference method, the pdepe MATLAB solver, and the Methodof Lines to give numerical solutions of the Fisher equation and the heat equation, andcompare the results with the exact solution of the Fisher equation and the exact solutionof the heat equation. The CPU times of these numerical methods have been determinedand the errors have been calculated. Considering the results of the tables and the fig-ures, we can say that all these numerical methods offer very accurate solutions to the twoparabolic equations. The pdepe MATLAB solver provides the best solution compared toother methods, but the CPU time is larger than the other CPU times. The explicit FDmethod also provides a very accurate solution in a very limited processor time, but thismethod is unstable when r is more than 0.5. The implicit FDM as well gives accuratesolution, more similar to the explicit method, but has the advantage of stability. TheMOL method also provides the same solution as the other methods for solving the Fisherequation and when solving the heat equation the MOL method gives the best solution.We additionally found that the extra discretization in the space and time, the accurate theoutcomes for all these methods.In the future, the Fisher equation can be studied in two or more dimensions using numeri-cal methods and we can compare the results with the exact solution.We can also study theparameter estimation of the Fisher equation by using MCMC methods.

Page 48: Comparing Numerical Methods for Solving the Fisher Equation

48

REFERENCES

[1] Uri M. Ascher, Numerical Methods for Evolutionary Differential Equations. Societyfor Industrial and Applied Mathematics , 2008.

[2] R. A. FISHER. T. The wave of advance of advantageous genes. Annals of Eugenics,7(4):355–369, 1937.

[3] H.F Weinberger D.G Aronson. Nonlinear diffusion in population genetics, com-bustion, and nerve propagation. Partial differential equations and related topics.Springer, Berlin, Heidelberg, 1975. 5-49.

[4] J.D. Murray Mathematical Biology II: spatial models and biomedical applications.Springer-Verlag, Vol. 3, 2001.

[5] Wojciech Zalewski and Piotr Antoni Gryglaszewski. Mathematical model of heatand mass transfer processes in evaporative fluid coolers. Chemical Engineering and

Processing: Process Intensification , 36(4):271 – 280, 1997.

[6] Berntaz, A.R. Fourier Series and Numirecal Method for Partial Difference Equation.Johan Wiley , Sons, Inc.(2010).

[7] Morton, K.W. Mayers,D.F. Numerical solution of partial differential equation. newyork , (2005).

[8] Smith,G.D. Numerical Solution of Partial Differential Equation. Clarendon press:Oxford, (1985).

[9] Ablowitz,M.J.and Zeppetella Explicit solutions of Fisher’s equation for a specialwave speed. Bull.Math.Bio.41(1979),835-840.

[10] X.Y. Zang, Exact and explicit solitary wave solutions for the generalized Fisher,equationPhysics Letters A , 131 (4) (1988), 277-279.

[11] A. M. Wazwaz, A.Gorguis, An analytic study of Fishers equation by using Adomiandecomposition method, equationAppl. Math. Comput. 154 (3)(2004) 609-620.

[12] A. D. Polyanin, V. F. Zaitsev, Handbook of Nonlinear Partial Differential equation,1st ed., hapman and Hall, CRC press, Boca Raton, 2003.

[13] Kolmogorov, A., I. Petrovskii and N. Piskunov. "Etude de l’lquation de la Diffu-sion avec Croissance de la Quantit6 de la Matiare et Son Application i un ProblmeBiologique." Moscow Univ. Bull. Math., (1),(1973), 1-25.

Page 49: Comparing Numerical Methods for Solving the Fisher Equation

49

[14] Abdullaev, U.G. Stability of Symmetric Travelling Waves in the Cauchy Problemfor the KPP Equation. Differential Equations , 30, (1994), 377-386.

[15] Logan, D.J. An Introduction to Nonlinear Partial Differential Equations. John Wiley,Sons, New York (1984).

[16] Gazdag, J.G. and Canosa, J.C. Numerical Solutions of Fisher’s Equation. Journalof Applied Probability , 11, (1974), 445-457.

[17] Tang, S.T., Qin, S.Q. and Weber, R.O. Numerical Solution of a Non Linear ReactionDiffusion Equation. Chinese J . of Appl . Math , and Mech , 12,(1991), 703-709.

[18] Tang, S.T. and Weber, R.O. Numerical Study of Fisher’s Equation by a Petrov-Galerkin Finite Element Method. Journal of the Australian Mathematical SocietySeries B, 33,(1991), 27-38.

[19] Khaled, K.A. Numerical Study of Fisher’s Diffusion Reaction Equation by theSinc Collocation Method Journal of Computational and Applied Mathematics ,137,(2001),245-255.

[20] Dag, I.D., Sahin, A.S. and Korkmaz, A.K. Numerical Investigation of the Solution ofFishers Equation via the B-Spline Galerkin Method Numerical Methods for PartialDifferential Equations , 26, (2010), 1483-1503.

[21] Mittal, R.C. and Rajni, R.R. A Study of One Dimensional Nonlinear DiffusionEquations by Bernstein Polynomial Based Differential Quadrature Method. Journalof Mathematical Chemistry , 2016, 1-23.

[22] Rahman, K.R., Helil, N.H. and Yimin, A.R. Some New Semi-Implicit Finite Dif-ference Schemes for Numerical Solution of Burgers Equation. International Confer-ence on Computer Application and System Modeling , 14, (2010),451-455.

[23] Li, S., Petzold, L., Ren, Y. Stability of moving mesh systems of partial differentialequations. SIAM J. Sci. Comput. 20,(1998), 719–738.

[24] Agurseven D, Ozis T. An analytical study for Fisher type equations by using homo-topy perturbation method. Comput Math Appl.(2010) ;60:602-609.

[25] Joseph G.,charles R. On Travelling Waves for the Stochastic Fisher -Kolmogorov-Pertrovsky-Piscunov Equation Journal of Statistical Physics Vol. 120,2005.

[26] M. F. K. Abur-Robb EXPLICIT SOLUTIONS OF FISHER’S EQUATION WITHTHREE ZEROS Internat.J.Math.Math.Sci VOL.13 NO.3(1990)617-620