The problem of solving several types of one-dimensional parabolic partial differential equations (PDEs) subject to the given initial and nonlocal boundary conditions is considered. The main idea is based on direct collocation and transforming the considered PDEs into their associated algebraic equations. After approximating the solution in the Legendre matrix form, we use Legendre operational matrix of differentiation for representing the mentioned algebraic equations clearly. Three numerical illustrations are provided to show the accuracy of the presented scheme. High accurate results with respect to the Bernstein Tau technique and Sinc collocation method confirm this accuracy.
1. Introduction
In real world, many fundamental laws of applied sciences and engineering can be formulated as differential equations. In biology and economics, differential equations are used to model the behavior of complex systems. The mathematical theory of differential equations first developed together with the sciences where the equations had originated and where the results found application. However, diverse problems, sometimes originating in quite distinct scientific fields, may give rise to identical differential equations. Whenever this happens, mathematical theory behind the equations can be viewed as a unifying principle behind diverse phenomena. As a powerful mathematical tool for modeling many of the natural models in applied sciences, one can refer to the partial differential equations (PDEs). In mathematics, a PDE is a differential equation that contains unknown multivariable functions and their partial derivatives. PDEs are used to formulate problems involving functions of several variables and are usually difficult to solve. So it is necessary to apply high accurate numerical methods. One-dimensional parabolic PDEs have a wide range of applications for modeling of diverse phenomena in physics and chemistry. Numerical solutions of such PDEs together with traditional conditions were studied deeply by researchers in literature. However, these PDEs subject to nonclassical conditions were investigated by mathematicians, but improvements of the existing methods should be done to get more accurate solutions. The usual numerical methods for PDEs subject to these nonclassical conditions are finite difference methods (FDMs), Galerkin techniques [1], collocation approaches [2], and Tau schemes [3]. Moreover, one can point out to the new methods such as Bernstein Tau technique [4], Sinc collocation method [5], and also [6]. It should be noted that, in [5], two types of one-dimensional parabolic PDEs subject to nonlocal boundary conditions were considered; meanwhile in [4] a different problem was considered for obtaining the solution numerically.
One of the well-known numerical techniques for solving PDEs is to use the collocation methods. In other words, collocation techniques have an important role in the field of numerical solution of PDEs. As we have mentioned before, among collocation methods, one can refer to [2]. In [2], a double Chebyshev series is introduced to represent approximately functions of two independent variables and is then applied to analyse a class of parabolic PDEs with nonlocal conditions. It should be mentioned that spectral approximations usually are the best tool for obtaining the numerical solution of any applied mathematical problem such as neutral functional differential equations [7] in the case of solution smoothness. Spectral methods have high accuracy with respect to FDMs and also finite element methods (FEMs). Among all the existing basis, the Legendre basis is a simple one for approximating the solutions of different types of PDEs. In addition, Legendre collocation method has had few results in the case of nonlocal boundary PDEs. This is the basic motivation of this paper. In this paper, in the light of the methods [8, 9], we present the Legendre collocation method for solving parabolic time-dependent diffusion equation
(1)∂u(x,t)∂t=∂2u(x,t)∂x2+Q(x,t),0<x<1,0<t≤1,
with the initial condition
(2)u(x,0)=f(x),0≤x≤1,
and different nonlocal boundary conditions.
Case 1 (see [<xref ref-type="bibr" rid="B8">4</xref>]).
Consider the following:
(3)u(0,t)=∫01ρ(x)u(x,t)dx,0<t≤1,(4)u(1,t)=∫01ψ(x)u(x,t)dx,0<t≤1.
Case 2 (see [<xref ref-type="bibr" rid="B9">5</xref>]).
Consider the following:
(5)u(0,t)=∫01k1(x,t)u(x,t)dx+g1(t),0<t≤1,u(1,t)=∫01k2(x,t)u(x,t)dx+g2(t),0<t≤1.
Case 3 (see [<xref ref-type="bibr" rid="B9">5</xref>]).
Consider the following:
(6)α1(t)ux(0,t)+β(t)u(0,t)=g1(t),0<t≤1,α2(t)ux(1,t)+γ(t)u(1,t)=g2(t),0<t≤1,
where Q(x,t), f(x), ρ(x), ψ(x), k1(x,t), k2(x,t), g1(t), g2(t), α1(t), α2(t), β(t), and γ(t) are known functions, while the function u should be determined. It should be noted that we deal with three types of one-dimensional parabolic PDEs in the form of (1) (with initial condition (2)). The first kind contains the boundary conditions (3)-(4). The second kind contains the boundary conditions (5), and the third kind contains the boundary conditions (6). In the sequel, we just focus on the numerical solution of PDE (1) subject to the initial condition (2) and nonlocal boundary conditions (3)-(4). The other two kinds can be solved by a similar approach.
The remainder of the paper is organized as follows. In the next Section, the basic idea of this paper is presented, in which the basic equation (1), subject the initial condition (2) together with the boundary conditions (3)-(4) ((5) and (6)), will be reduced to the associated algebraic equation. Section 3 is devoted to report three numerical experiments which demonstrate the accuracy of the proposed numerical scheme for solving the considered PDEs. Robustness of the presented approach with respect to the Bernstein Tau technique [4] and Sinc collocation method [5] is illustrated in this section. Finally, the paper is ended with a brief conclusion in Section 4.
2. Basic Idea
In this section, by using shifted Legendre polynomials, the basic equation (1) subject to the initial (2) and boundary conditions (3)-(4) will be collocated at a uniform mesh to transform it into the associated system of algebraic equations. In other words, we just apply the Legendre collocation method for Case 1 boundary conditions. Other two cases can be solved by using a similar idea. Moreover, for clarity of presentation, we use the Legendre operational matrix of differentiation in our computations. For this purpose, we should recall the shifted Legendre polynomials in the interval [0,1] and also the corresponding Legendre operational matrix of differentiation as follows.
We assume that L(x)=[L0(x)L1(x)⋯LN(x)], where Ln(x) (n=0,1,…,N) denotes the nth order shifted Legendre polynomial in the interval [0,1]. Some of initial order shifted Legendre polynomials are
(7)L0(x)=1,L1(x)=2x-1,L2(x)=6x2-6x+1,L3(x)=20x3-30x2+12x-1.
According to the following property [7]:
(8)Ln(x)=12(2n+1)(Ln+1′(x)-Ln-1′(x)).
One can conclude that L′(x)=L(x)M, where M is the Legendre operational matrix of differentiation and
(9)M=2[0101⋯100030⋯030005⋯50⋮⋮⋮⋮⋱⋮⋮0000⋯2N-300000⋯02N-10000⋯00]
if N is an even number and
(10)M=2[0101⋯010030⋯300005⋯05⋮⋮⋮⋮⋱⋮⋮0000⋯2N-300000⋯02N-10000⋯00]
if N is an odd number.
We now turn into approximating the solution of the above-mentioned PDE subject to its initial and boundary conditions in the form
(11)u(x,t)≈uN(x,t)=∑m=0N∑n=0NumnLm(x)Ln(t)=L(x,t)U,
where(12)L(x,t)=[L0(x)L0(t)⋯L0(x)LN(t)⋯LN(x)L0(t)⋯LN(x)LN(t)]=L(x)⊗L(t),in which “⊗” denotes the Kronecker multiplication and U=[u00⋯u0N⋯uN0⋯uNN]T. We note that U is unknown and should be determined. Also, uN,t(x,t)=L(x,t)M^U, where M^=IN+1⊗M, because
(13)uN,t(x,t)=(L(x)⊗L(t))tU=[(L(x)IN+1)⊗(L(t)M)]U=(L(x)⊗L(t))(IN+1⊗M)U.
By a similar idea one can conclude that uN,xx(x,t)=L(x,t)M~U, where M~=M2⊗IN+1. We now assume that Q(x,t) is given and 0=x0<x1<⋯<xN=1, 0=t0<t1<⋯<tN=1, in which xi=ti=i/N for i=0,1,…,N. Before starting the collocation scheme, we approximate u(x,t) by uN(x,t). According to the structure of (1) (0<x<1, 0<t≤1) one can collocate this equation as follows (see the purple rhombus ◆ in Figure 1):
(14)∂uN(xi,tj)∂t=∂2uN(xi,tj)∂x2+Q(xi,tj),i=1,2,…,N-1,j=1,2,…,N.
Collocation points in the square [0,1]×[0,1] for N=5.
In other words
(15)L(xi,tj)(M^-M~)U=Q(xi,tj),i=1,2,…,N-1,j=1,2,…,N.
We should collocate the initial condition (2) in the form (see the black squares ■ in Figure 1)
(16)L(xi,0)U=f(xi),i=0,1,…,N.
Collocating the boundary condition (3) yields (see the red triangles ▲ in Figure 1)
(17)[L(x0,tj)-(∫01ρ(x)L(x)dx)⊗L(tj)]U=0,j=1,2,…,N.
Moreover, collocating the boundary condition (4) yields (see the blue down triangles ▼ in Figure 1)
(18)[L(xN,tj)-(∫01ψ(x)L(x)dx)⊗L(tj)]U=0,j=1,2,…,N.
The above-mentioned algebraic equations can be rewritten in the matrix form AU=b, where
(19)A=[L(x1,t1)(M^-M~)⋮L(x1,tN)(M^-M~)⋮L(xN-1,t1)(M^-M~)⋮L(xN-1,tN)(M^-M~)L(x0,0)⋮L(xN,0)L(x0,t1)-(∫01ρ(x)L(x)dx)⊗L(t1)⋮L(x0,tN)-(∫01ρ(x)L(x)dx)⊗L(tN)L(xN,t1)-(∫01Ψ(x)L(x)dx)⊗L(t1)⋮L(xN,tN)-(∫01Ψ(x)L(x)dx)⊗L(tN)](N+1)2×(N+1)2,b=[Q(x1,t1)⋮Q(x1,tN)⋮Q(xN-1,t1)⋮Q(xN-1,tN)f(x0)⋮f(xN)0⋮00⋮0](N+1)2×1.
We note that the algebraic system AU=b can be solved by direct or iterative solvers. In this paper, we will solve this equation directly. However, some robust Krylov subspace iterative methods may be chosen and suitable preconditioning techniques can be applied for this algebraic system. It should be mentioned that the other two kinds of parabolic PDEs with their nonlocal boundary conditions (Cases 2 and 3) can be transformed into their associated linear algebraic systems.
3. Numerical Experiments
In this part of paper, three numerical examples are considered to show the efficiency of the presented method. In these examples, the associated algebraic matrix equations AU=b are solved by a direct method in MAPLE software. It should be noted that all of the programs of the proposed method were written in MAPLE 13 software with the Digits environment variable assigned to be 30 to determine the unknown vector U and hence the approximated solution uN(x,t)=L(x,t)U. All calculations are run on a Pentium 4 PC laptop with 2 GHz of CPU and 2 GB of RAM. It should be mentioned that the proposed scheme obtained high order of accuracy for dealing with the mentioned PDEs which are smooth enough. The readers can see the efficiency of the proposed method from the provided figures and table in the following examples. In Case 1, we provide the following example from [4] and give the absolute errors eN(i/10,i/10)=|u(i/10,i/10)-uN(i/10,i/10)| for i=1,2,…,10 and N=8 in Table 1. From this table one can see the efficiency of the proposed scheme with respect to the Bernstein Tau method (BTM) [4].
Error |e8(x,t)|(=|u(x,t)-u8(x,t)|) comparison of the PM and BTM for Example 1.
(x,t)
PM
BTM
(0,0)
3.86722e-029
1.31773e-007
(0.1,0.1)
2.31062e-006
7.87467e-005
(0.2,0.2)
2.52185e-006
2.05301e-004
(0.3,0.3)
2.87530e-006
3.11401e-004
(0.4,0.4)
3.20632e-006
3.78699e-004
(0.5,0.5)
3.56079e-006
4.02938e-005
(0.6,0.6)
3.97452e-006
3.84876e-004
(0.7,0.7)
4.46780e-006
3.28180e-004
(0.8,0.8)
5.01629e-006
2.38398e-004
(0.9,0.9)
6.08046e-006
1.25456e-004
(1.0,1.0)
7.63453e-030
1.31773e-007
Example 1 (Case 1 [<xref ref-type="bibr" rid="B8">4</xref>]).
We consider the PDE (1) subject to the initial condition (2) and nonlocal boundary conditions (3)-(4) with the assumptions
(20)f(x)=sin(πx),Q(x,t)=(π2+1)etsin(πx),ρ(x)=0,ψ(x)=0,
which has the exact solution u(x,t)=etsin(πx). For solving this problem, we use different values of N and obtain the numerical solution uN(x,t)=L(x,t)U. Absolute values of error associated with the presented method (PM) and Bernstein Tau method (BTM) are provided in Table 1 for N=8. These results confirm the efficiency of the proposed idea.
Example 2 (Case 2 [<xref ref-type="bibr" rid="B9">5</xref>]).
We consider the PDE (1) subject to the initial condition (2) and nonlocal boundary conditions (5) with the assumptions
(21)f(x)=1+cos(x),Q(x,t)=0,g1(t)=12+e-t-t-e-t(-1+cos(1)+sin(1)+tsin(1)),g2(t)=1+e-tcos(1)-t2e(2(-1+e)+e-t(e-cos(1)+sin(1))),k1(x,t)=x+t,k2(x,t)=te-x,
which has the exact solution u(x,t)=1+e-tcos(x). For solving this problem, we use different values of N such as 5, 7, 9, 11, 13, and 15 and obtain the EN=max{|u(i/50,i/50)-uN(i/50,i/50)|,i=1,2,…,50} in definite CPU times for each of the mentioned values of N. It should be recalled that, in [5], the authors used different values of N such as 5, 10, 15, 20, 25, and 30 and obtained the EN=max{|u(i/50,i/50)-uN(i/50,i/50)|,i=1,2,…,50} for each of the chosen values of N in some CPU times. For comparing the accuracy of our presented Legendre collocation method (LCM) and Sinc collocation method (SCM) [5], we plot Figure 2, in which the horizontal axis is CPU time and the vertical axis is the log10(1/EN). From this figure, one can see the efficiency of our LCM with respect to the SCM.
Efficiency comparison of the Legendre collocation method and Sinc collocation method.
Example 3 (Case 3 [<xref ref-type="bibr" rid="B9">5</xref>]).
We consider the PDE (1) subject to the initial condition (2) and nonlocal boundary conditions (6) with the assumptions
(22)f(x)=sin(πx)+cos(πx),Q(x,t)=(π2-1)exp(-t)(sin(πx)+cos(πx)),g1(t)=e-t(t2+π),g2(t)=-e-t(t+π),αi(t)=1,i=1,2,β(t)=t2,γ(t)=t,
which has the exact solution u(x,t)=exp(-t)(sin(πx)+cos(πx)). Similar to the previous example, we use different values of N such as 5, 7, 9, 11, 13, and 15 and obtain the EN=max{|u(i/50,i/50)-uN(i/50,i/50)|,i=1,2,…,50} in definite CPU times for each of the mentioned values of N. It should be recalled that, in [5], the authors used different values of N such as 5, 10, 15, 20, 25, and 30 and obtained the EN=max{|u(i/50,i/50)-uN(i/50,i/50)|,i=1,2,…,50} for each of the chosen values of N in some CPU times. For comparing the accuracy of our LCM and SCM [5], we plot Figure 3, in which the horizontal axis is CPU time and the vertical axis is the log10(1/EN). From this figure, one can see the sharp slope of our LCM with respect to the low slope of the SCM. This confirms the accuracy of our method.
Efficiency comparison of the Legendre collocation method and Sinc collocation method.
4. Conclusions
Legendre collocation method has been utilized to numerically solve a class of one-dimensional parabolic partial differential equations (PDEs) subject to the nonlocal boundary conditions by a new framework. The proposed approach reduces the main problem to the linear algebraic equations. By using Legendre operational matrix of differentiation, these equations are showed in a matrix form clearly. Three numerical examples have been illustrated to show the efficiency and applicably of the presented method.
Conflict of Interests
The authors declare that they do not have any conflict of interests in their submitted paper.
Acknowledgments
The authors gratefully acknowledge that this work partially supported by the University Putra Malaysia Grant No. 5527179.
BouzianiA.MerazgaN.BenamiraS.Galerkin method applied to a parabolic evolution problem with nonlocal boundary conditionsGolbabaiA.JavidiM.A numerical solution for non-classical parabolic problem based on Chebyshev spectral collocation methodSaadatmandiA.RazzaghiM.A Tau method approach for the diffusion equation with nonlocal boundary conditionsYousefiS. A.BehroozifarM.DehghanM.The operational matrices of Bernstein polynomials for solving the parabolic equation subject to specification of the massZolfaghariR.ShidfarA.Solving a parabolic PDE with nonlocal boundary conditions using the Sinc methodAngW.-T.Numerical solution of a non-classical parabolic problem: an integro-differential approachBhrawyA. H.AssasL. M.TohidiE.AlghamdiM. A.A Legendre-Gauss collocation method for neutral functionaldifferential
equations with proportional delaysTohidiE.KılıcmanA.A collocation method based on the bernoulli operational matrix for solving nonlinear BVPs which arise from thep in calculus of variationToutounianF.TohidiE.ShateyiS.A collocation method based on the bernoulli operational matrix for solving high-order linear complex differential equations in a rectangular domain