1 Introduction

The classical type of conditions is referred to as local conditions when the values of the unknown function or its derivative are specified only at the boundary points of the problem domain, while the non-local boundary conditions are proposed where the values of the unknown function at all or some points inside the problem domain take part in the condition formulation. The development of numerical methods for the solution of non-local boundary value problems has been a very important research area. There are many models and works about non-local boundary conditions, such as elliptic equations [10, 15], elliptic–parabolic equations [3, 4], hyperbolic equations [2, 7, 16, 17], hyperbolic–parabolic equations [5] and parabolic equations [1, 8, 9, 11,12,13].

We recall two cases of non-local boundary conditions. The first one is the integral boundary conditions

$$\begin{aligned} u(0,t)= & {} \int _0^L\alpha (s)u(s,t)\mathrm {d}s+g_1(t),\nonumber \\ u(L,t)= & {} \int _0^L\beta (s)u(s,t)\mathrm {d}s+g_2(t),\quad 0\le {t}\le {T}, \end{aligned}$$
(1)

where \(\alpha ,\beta ,g_1,g_2\) are known functions. Another one is the multi-point boundary value conditions

$$\begin{aligned} u(0,t)= & {} \sum _{r=1}^M\alpha _r(t)u(\xi _r,t)+g_1(t),\nonumber \\ {u}(L,t)= & {} \sum _{s=1}^N\beta _s(t)u(\eta _s,t)+g_2(t),\quad 0\le {t}\le {T}, \end{aligned}$$
(2)

where \(\alpha _r,\beta _s,g_1,g_2\) are known functions.

There is a lot of research on the integral boundary conditions and multi-point boundary conditions under different models. Sun considered the heat equations with integral boundary conditions (1) and got unconditional solvability and \(L_\infty\) convergence for the difference scheme which was second order in time and fourth order in space [13]. Martin-Vaquero and Vigo-Aguiar provided a compact difference scheme for the same problem by the fourth-order Simpson’s composite formula and Crandall’s formula [11]. They improved the accuracy of this algorithm and studied the convergence later in [12]. They all used the composite Simpson rule to approximate the boundary conditions. Yildirim and Uzun established stable difference schemes with third and fourth order for the hyperbolic multi-point non-local boundary value problem [16]. They provided stability estimates and numerical analysis for the solutions of the difference schemes. Ashyralyev and Gercek considered a finite difference method for solving the multi-point elliptic–parabolic partial differential equation and obtained stability, and coercive stability for the solution of the difference scheme [4]. Alikhanov studied multi-point boundary conditions (2) for the heat equation with variable coefficients in the differential and finite-difference settings [1]. He established the difference scheme which is second order both in space and in time. Using the method of energy inequalities, prior estimates for the corresponding differential and finite-difference problems are obtained. Due to the characteristic of the multi-point boundary condition, he just proved the prior estimates in a weighted \(L^2\) norm.

Our work is a good supplement to the previous researches. In this article, we construct a compact difference scheme for the multi-point boundary value problem of the heat equation taking the form of

$$\begin{aligned}&\frac{\partial {u}}{\partial {t}}-a\frac{\partial ^2u}{\partial {x}^2}+bu=f(x,t),\quad 0<x<L,\quad 0<t\le {T}, \end{aligned}$$
(3)
$$\begin{aligned}&u(0,t)=\sum _{r=1}^M\alpha _r(t)u(\xi _r,t)+\mu _1(t),\nonumber \\&{u}(L,t)=\sum _{s=1}^N\beta _s(t)u(\eta _s,t)+\mu _2(t),\quad 0<t\le {T}, \end{aligned}$$
(4)
$$\begin{aligned}&u(x,0)=\varphi (x),\quad 0\le {x}\le {L}, \end{aligned}$$
(5)

where \(a>0\) and \(b>0\) are given constants, \(\alpha _r(t),\)\(\beta _s(t),\)\(\mu _1(t),\)\(\mu _2(t)\in C[0,T],\)\(0<\xi _1<\xi _2<\cdots<\xi _M<L,\)\(0<\eta _1<\eta _2<\cdots<\eta _N<L,\)f and \(\varphi\) are continuous functions. We establish a compact difference scheme with the truncation error \(O(\tau ^2+h^4)\) and get a weighted L2 norm prior estimate. Then, we prove the unique solvability, convergence and stability using the energy method.

The rest of this paper is organized as follows: some notations are introduced and several important lemmas are given in Sect. 2. Then, a compact difference scheme is constructed in Sect. 3 and a prior estimate is provided in Sect. 4. Based on a prior estimate, the unique solvability, stability and convergence are proved in Sect. 5. Besides, a compact finite-difference scheme is also given for the multi-point boundary value problems of the heat equation with variable coefficients in Sect. 6. At last, two numerical examples are presented in Sect. 7 and a brief conclusion is given in Sect. 8, respectively.

2 Preliminary

In this section, some useful notations and lemmas will be prepared.

For finite-difference approximation, we discretize equally the interval [0, L] with \(x_i=ih\;(0\le {i}\le {m}),\) [0, T] with \(t_k=k\tau \;(0\le {k}\le {n}),\) where \(h=L/m\) and \(\tau =T/n\) are the spatial and temporal step sizes, respectively. Denote \(t_{k+\frac{1}{2}}=(t_k+t_{k+1})/2,\)\(\Omega _h=\{x_i\;|\;0\le {i}\le {m}\},\)\(\Omega _\tau =\{t_k\;|\;0\le {k}\le {n}\},\) then the computational domain \([0,L]\times [0,T]\) is covered by \(\Omega _h\times \Omega _\tau .\) For any mesh function \(v=\{v_i^k\;|\;0\le {i}\le {m},\;0\le {k}\le {n}\}\) defined on \(\Omega _h\times \Omega _\tau ,\) introduce the following notations:

$$\begin{aligned} v_i^{k+\frac{1}{2}}&=\frac{1}{2}\left( v_i^k+v_i^{k+1}\right) ,\quad \delta _t v_i^{k+\frac{1}{2}}=\frac{1}{\tau }\left( v_i^{k+1}-v_i^k\right) ,\\ \delta _xv_{i+\frac{1}{2}}^k&=\frac{1}{h}\left( v_{i+1}^k-v_i^k\right) ,\quad \delta _x^2v_i^k=\frac{1}{h}\left( \delta _xv_{i+\frac{1}{2}}^k-\delta _xv_{i-\frac{1}{2}}^k\right) . \end{aligned}$$

Let \(v^k=(v_0^k,v_1^k,\ldots ,v_m^k),\) then \(v^k\) is a mesh function defined on \(\Omega _h.\)

Denote

$$\begin{aligned} V_h=\left\{ v\,|\,v=(v_0,v_1,\ldots ,v_m)\right\} \end{aligned}$$

and

$$\begin{aligned} p(x)=\sqrt{x(L-x)},\quad 0\le x\le L. \end{aligned}$$

For any \(v\in V_h,\) introduce the following norms or seminorms:

$$\begin{aligned} \begin{aligned}&\Vert v\Vert _\infty =\max _{0\le i\le m}|v_i|,\quad \Vert v\Vert =\sqrt{h\left( \frac{1}{2}v_0^2+\sum _{i=1}^{m-1}v_i^2+\frac{1}{2}v_m^2\right) },\quad |v|_1=\sqrt{h\sum _{i=0}^{m-1}\left( \delta _xv_{i+\frac{1}{2}}\right) ^2},\\&\Vert v\Vert _0=\sqrt{h\sum _{i=1}^{m-1}v_i^2},\quad \Vert p v\Vert _0=\sqrt{h\sum _{i=1}^{m-1}p_i^2v_i^2},\quad |p v|_1=\sqrt{h\sum _{i=0}^{m-1}\frac{p_i^2+p_{i+1}^2}{2}\left( \delta _xv_{i+\frac{1}{2}}\right) ^2}. \end{aligned} \end{aligned}$$

For any \(0<c<d<L,\) define

$$\begin{aligned} x_{m_0}=\min _{x_i\in [c, d]}x_i,\quad x_{n_0}=\max _{x_i\in [c, d]}x_i. \end{aligned}$$

With an assumption that \(2h<d-c,\) we give similar definitions in the interval [cd]:

$$\begin{aligned} \Vert v\Vert _{\infty ,[c, d]}&=\max _{c\le x_i\le d}|v_i|,\quad \Vert v\Vert _{[c, d]}=\sqrt{h\left( \frac{1}{2}v_{m_0}^2+\sum _{i=m_0+1}^{n_0-1}v_i^2+\frac{1}{2}v_{n_0}^2\right) },\nonumber \\ |v|_{1,[c, d]}&=\sqrt{h\sum _{i=m_0}^{n_0-1}\left( \delta _xv_{i+\frac{1}{2}}\right) ^2},\\ \Vert p v\Vert _{[c, d]}&=\sqrt{h\left( \frac{1}{2}p_{m_0}^2v_{m_0}^2+\sum _{i=m_0+1}^{n_0-1}p_i^2v_i^2+\frac{1}{2}p_{n_0}^2v_{n_0}^2\right) },\nonumber \\ |p v|_{1,[c, d]}&=\sqrt{h\sum _{i=m_0}^{n_0-1}\frac{p_i^2+p_{i+1}^2}{2}(\delta _xv_{i+\frac{1}{2}})^2}. \end{aligned}$$

For any grid function \(w\in V_h,\) define

$$\begin{aligned} ({\mathcal {A}}w)_i=\left\{ \begin{aligned}&\frac{1}{12}(w_{i-1}+10w_i+w_{i+1}),\quad 1\le i\le m-1,\\&w_i,\quad i=0,\,m. \end{aligned} \right. \end{aligned}$$

We need some lemmas for establishing and analyzing the difference scheme for (3)–(5).

Lemma 2.1

[14] Let\(v\in V_h.\)Then, for any\(\varepsilon >0,\)we have

$$\begin{aligned}&\Vert v\Vert _\infty ^2\le \varepsilon |v|_1^2+\left( \frac{1}{\varepsilon }+\frac{1}{L}\right) \Vert v\Vert ^2,\\&\Vert v\Vert _{\infty ,[c, d]}^2\le \varepsilon |v|_{1,[c, d]}^2+\left( \frac{1}{\varepsilon }+\frac{1}{x_{n_0}-x_{m_0}}\right) \Vert v\Vert _{[c, d]}^2. \end{aligned}$$

Lemma 2.2

Let \(v\in V_h\) and \(0<c<d<L.\) If \(h<(d-c)/4,\) then for any \(\varepsilon >0,\) we have

$$\begin{aligned} \Vert v\Vert _{\infty ,[c, d]}^2\le \varepsilon |p v|_1^2+\left( \frac{1}{c_0^2\varepsilon }+\frac{2}{c_0(d-c)}\right) \Vert p v\Vert _0^2, \end{aligned}$$

where \(c_0=\min \{c(L-c), d(L-d)\}.\)

Proof

According to Lemma 2.1, we have

$$\begin{aligned} \Vert v\Vert _{\infty ,[c, d]}^2&\le c_0\varepsilon |v|_{1,[c, d]}^2+\left( \frac{1}{c_0\varepsilon }+\frac{1}{x_{n_0}-x_{m_0}}\right) \Vert v\Vert _{[c, d]}^2\\&\le c_0\varepsilon |v|_{1,[c, d]}^2+\left( \frac{1}{c_0\varepsilon }+\frac{1}{d-c-2h}\right) \Vert v\Vert _{[c, d]}^2\\&\le \varepsilon |p v|_{1,[c, d]}^2+\left( \frac{1}{c_0^2\varepsilon }+\frac{2}{c_0(d-c)}\right) \Vert p v\Vert _{[c, d]}^2\\&\le \varepsilon |p v|_1^2+\left( \frac{1}{c_0^2\varepsilon }+\frac{2}{c_0(d-c)}\right) \Vert p v\Vert _0^2. \end{aligned}$$

This completes the proof.

Lemma 2.3

For any grid function \(v\in V_h,\) we have

$$\begin{aligned} \Vert p v\Vert _0^2\le \frac{12}{5}\Vert p({\mathcal {A}}v)\Vert _0^2+\frac{h^2L}{6}(v_0^2+v_m^2). \end{aligned}$$

Proof

From the definition, we can get

$$\begin{aligned} \Vert p({\mathcal {A}}v)\Vert _0^2&=h\sum _{i=1}^{m-1}p_i^2({\mathcal {A}}v_i)^2=\frac{h}{144}\sum _{i=1}^{m-1}p_i^2(v_{i-1}+10v_i+v_{i+1})^2\\&=\frac{h}{144}\sum _{i=1}^{m-1}p_i^2\left[ (v_{i-1}+v_{i+1})^2+100v_i^2+20v_i(v_{i-1}+v_{i+1})\right] \\&\ge \frac{h}{144}\sum _{i=1}^{m-1}p_i^2\left[ 100v_i^2-20v_i^2-10(v_{i-1}^2+v_{i+1}^2)\right] \\&=\frac{40h}{72}\sum _{i=1}^{m-1}p_i^2v_i^2-\frac{5h}{72}\left( \sum _{i=0}^{m-2}p_{i+1}^2v_i^2+\sum _{i=2}^mp_{i-1}^2v_i^2\right) \\&\ge \frac{5}{12}\Vert p v\Vert ^2+\frac{5h}{72}\sum _{i=1}^{m-1}(2p_i^2-p_{i-1}^2-p_{i+1}^2)v_i^2-\frac{5h^2(L-h)}{72}(v_0^2+v_m^2)\\&\ge \frac{5}{12}\Vert p v\Vert ^2-\frac{5h^2L}{72}(v_0^2+v_m^2). \end{aligned}$$

In obtaining the last inequality, we have used \(2p_i^2-p_{i-1}^2-p_{i+1}^2>0\) when \(1\le i\le m-1.\)

This completes the proof.

Lemma 2.4

Suppose\(f(x)\in C[d,d+3h].\)Taking\(d,\;d+h,\;d+2h,\;d+3h\)as the interpolation points, we obtain the third-order interpolation polynomial off(x):

$$ L_3(x)=\sum _{i=0}^3f(d+i h)\prod _{\stackrel {j=0} {j\ne {i}}}^3\frac{x-(d+j h)}{(d+i h)-(d+j h)}. $$

Then, it satisfies

$$\begin{aligned} \max _{d+h\le x\le d+2h}|L_3(x)|\le \frac{5}{4}\max _{0\le i\le 3}|f(d+i h)|. \end{aligned}$$

Proof

Let

$$\begin{aligned} s=(x-d)/h, \qquad x\in [d+h, d+2h]. \end{aligned}$$

We have

$$\sum _{i=0}^3\prod _{\stackrel{ j=0} {j\ne {i}} }^3\left| \frac{x-(d+j h)}{(d+i h)-(d+j h)}\right| =\sum _{i=0}^3\prod _{\stackrel {j=0} {j\ne {i}}}^3\left| \frac{s-j}{i-j}\right| =\frac{5}{4}-\left( s-\frac{3}{2}\right) ^2,\quad 1\le s\le 2.$$

Therefore, we obtain

$$ \max _{d+h\le x\le d+2h}|L_3(x)|\le \sum _{i=0}^3\prod _{\stackrel{j=0} {j\ne {i}}}^3\left| \frac{x-(d+j h)}{(d+i h)-(d+j h)}\right| \max _{0\le i\le 3}|f(d+i h)|=\left[ \frac{5}{4}-\left( s-\frac{3}{2}\right) ^2\right] \max _{0\le i\le 3}|f(d+i h)|\le \frac{5}{4}\max _{0\le i\le 3}|f(d+i h)|.$$

This completes the proof.

Lemma 2.5

[14] Let\(h>0\)andcbe two constants. Suppose\(g(x)\in {C}^6[c-h,c+h].\)Then,

$$\begin{aligned}&\frac{1}{12}[g''(c-h)+10g''(c)+g''(c+h)]\\& =\frac{1}{h^2}\left[g(c+h)-2g(c)+g(c-h)\right]+\frac{h^4}{240}g^{(6)}(\xi ),\, {c-h} < \xi < c+h. \end{aligned}$$

Lemma 2.6

[6] Let\(\{F^k\;|\;k\ge 0\}\)and\(\{G^k\;|\;k\ge 0\}\)be two nonnegative sequences and satisfy

$$\begin{aligned} F^{k+1}\le (1+c\tau )F^k+\tau {G^k},\quad {k}=0,1,2,\ldots , \end{aligned}$$

wherecis a nonnegative constant. Then, we have

$$\begin{aligned} F^{k+1}\le {e}^{c(k+1)\tau }\left( F^0+\tau \sum _{l=0}^{k}G^l\right) ,\quad {k}=0,1,2,\ldots . \end{aligned}$$

3 Derivation of the Difference Scheme

Define a grid function

$$\begin{aligned} U=\left\{ U_i^k\;|\;0\le i\le m,\;0\le k\le n\right\} \end{aligned}$$

on \(\Omega _h\times \Omega _\tau ,\) where

$$\begin{aligned} U_i^k=u(x_i,t_k),\quad 0\le i\le m,\;0\le k\le n. \end{aligned}$$

Suppose h is small enough satisfying \(\xi _1>2h,\)\(\xi _M<L-2h,\)\(\eta _1>2h,\) and \(\eta _N<L-2h,\) that is, \(h <\frac{1}{2} \min \{\xi _1, L-\xi _M, \eta _1, L-\eta _N\}.\)

Considering the differential equation (3) at point \((x_i,t_{k+\frac{1}{2}}),\) we have

$$\begin{aligned} \frac{\partial {u}}{\partial {t}}\left( x_i,t_{k+\frac{1}{2}}\right) -a\frac{\partial ^2u}{\partial {x}^2}\left( x_i,t_{k+\frac{1}{2}}\right) +bu\left( x_i,t_{k+\frac{1}{2}}\right) =f\left( x_i,t_{k+\frac{1}{2}}\right) ,\quad 0\le i\le m,\;0\le k\le n-1. \end{aligned}$$
(6)

By the Taylor expansion, we get

$$\begin{aligned}&\delta _tU_i^{k+\frac{1}{2}}-\frac{a}{2}\left[ \frac{\partial ^2u}{\partial {x}^2}(x_i,t_k)+\frac{\partial ^2u}{\partial {x}^2}(x_i,t_{k+1})\right] +b{U}_i^{k+\frac{1}{2}}\nonumber \\& =f_i^{k+\frac{1}{2}}+O(\tau ^2),\quad 0\le {i}\le {m},\;0\le {k}\le {n-1}, \end{aligned}$$

where \(f_i^{k+\frac{1}{2}}=f(x_i,t_{k+\frac{1}{2}}).\) Acting the operator \({\mathcal {A}}\) on the above equation, we obtain

$$\begin{aligned}&{\mathcal {A}}\delta _tU_i^{k+\frac{1}{2}}-\frac{a}{2}\left[ {\mathcal {A}}\frac{\partial ^2u}{\partial {x}^2}(x_i,t_k)+{\mathcal {A}}\frac{\partial ^2u}{\partial {x}^2}(x_i,t_{k+1})\right] +b{\mathcal {A}}U_i^{k+\frac{1}{2}}\nonumber \\& ={\mathcal {A}}f_i^{k+\frac{1}{2}}+O(\tau ^2),\quad 1\le {i}\le {m-1},\;0\le {k}\le {n-1}. \end{aligned}$$
(7)

Using Lemma 2.5, we have

$$\begin{aligned} \frac{1}{2}\left[ {\mathcal {A}}\frac{\partial ^2u}{\partial x^2}(x_i,t_k)+{\mathcal {A}}\frac{\partial ^2u}{\partial x^2}(x_i,t_{k+1})\right] =\delta _x^2U_i^{k+\frac{1}{2}}+O(h^4). \end{aligned}$$
(8)

Substituting (8) into (7), we obtain

$$\begin{aligned} {\mathcal {A}}\delta _tU_i^{k+\frac{1}{2}}-a\delta _x^2U_i^{k+\frac{1}{2}}+b{\mathcal {A}}U_i^{k+\frac{1}{2}}={\mathcal {A}}f_i^{k+\frac{1}{2}}+R_i^{k+\frac{1}{2}},\quad 1\le i\le m-1,\;0\le k\le n-1. \end{aligned}$$
(9)

There exists a constant \({\hat{c}}_1\) such that

$$\begin{aligned} |R_i^{k+\frac{1}{2}}|\le {{\hat{c}}_1}(\tau ^2+h^4),\quad 1\le {i}\le {m-1},\;0\le {k}\le {n-1}. \end{aligned}$$
(10)

Considering boundary value conditions (4) at \(t_{k+\frac{1}{2}},\) we have

$$\begin{aligned} U_0^{k+\frac{1}{2}}=\sum _{r=1}^M\alpha _r\left( t_{k+\frac{1}{2}}\right) \frac{u\left( \xi _r,t_{k}\right) +u\left( \xi _r,t_{k+1}\right) }{2}+\mu _1\left( t_{k+\frac{1}{2}}\right) +O\left( \tau ^2\right) ,\quad 0\le {k}\le {n-1}, \end{aligned}$$
(11)
$$\begin{aligned} U_m^{k+\frac{1}{2}}=\sum _{s=1}^N\beta _s\left( t_{k+\frac{1}{2}}\right) \frac{u\left( \eta _s,t_{k}\right) +u\left( \eta _s,t_{k+1}\right) }{2}+\mu _2\left( t_{k+\frac{1}{2}}\right) +O\left( \tau ^2\right) ,\quad 0\le {k}\le {n-1}. \end{aligned}$$
(12)

For any \(\xi _r,\) there exists a unique \(i_r\) such that \(\xi _r\in [x_{i_r+1}, x_{i_r+2}).\) Taking \(x_{i_r},\)\(x_{i_r+1},\)\(x_{i_r+2},\)\(x_{i_r+3}\) as the interpolation points, we obtain the third-order interpolation polynomial of u(xt): 

$$ L_r^{(0)}(x,t)=\sum _{p=i_r}^{i_r+3}u(x_{p},t)\prod _{\stackrel {q=i_r}{q\ne {p}}}^{i_r+3}\frac{x-x_q}{x_p-x_q}$$

and we have

$$\begin{aligned} u(\xi _r,t)=L_r^{(0)}(\xi _r,t)+O(h^4),\quad 1\le {r}\le {M}. \end{aligned}$$
(13)

Similarly, for any \(\eta _s,\) there is a unique \(j_s\) satisfying \(\eta _s\in [ x_{j_s+1}, x_{j_s+2}).\) Taking \(x_{j_s},\)\(x_{j_s+1},\)\(x_{j_s+2},\)\(x_{j_s+3}\) as interpolation points, we obtain the third-order interpolation polynomial of u(xt): 

$$L_s^{(1)}(x,t)=\sum _{p=j_s}^{j_s+3}u(x_{p},t)\prod _{\stackrel{q=j_s} {q\ne {p}}}^{j_s+3}\frac{x-x_q}{x_p-x_q}$$

and we have

$$\begin{aligned} u(\eta _s,t)=L_s^{(1)}(\eta _s,t)+O(h^4),\quad 1\le {s}\le {N}. \end{aligned}$$
(14)

Substituting (13) into (11) and (14) into (12), we get

$$\begin{aligned} {\begin{array}{ll} &{}U_0^{k+\frac{1}{2}}=\displaystyle \sum _{r=1}^M\alpha _r\left( t_{k+\frac{1}{2}}\right) \frac{L_r^{\left( 0\right) }\left( \xi _r,t_k\right) +L_r^{\left( 0\right) }\left( \xi _r,t_{k+1}\right) }{2}+\mu _1\left( t_{k+\frac{1}{2}}\right) +R_0^{k+\frac{1}{2}},\quad 0\le {k}\le {n-1}, \\ &{}U_m^{k+\frac{1}{2}}=\displaystyle \sum _{s=1}^N\beta _s\left( t_{k+\frac{1}{2}}\right) \frac{L_s^{\left( 1\right) }\left( \eta _s,t_k\right) +L_s^{\left( 1\right) }\left( \eta _s,t_{k+1}\right) }{2}+\mu _2\left( t_{k+\frac{1}{2}}\right) +R_m^{k+\frac{1}{2}},\quad 0\le {k}\le {n-1}, \end{array} } \end{aligned}$$

or

$$ U_0^{k+\frac{1}{2}}= \sum _{r=1}^M\alpha _r\left( t_{k+\frac{1}{2}}\right) \left( \sum _{p=i_r}^{i_r+3}U_{p}^{k+\frac{1}{2}}\prod _{\stackrel {q=i_r} {q\ne {p}}}^{i_r+3}\frac{\xi _r-x_q}{x_p-x_q}\right) +\mu _1\left( t_{k+\frac{1}{2}}\right) +R_0^{k+\frac{1}{2}},\quad 0\le {k}\le {n-1},$$
(15)
$$ U_m^{k+\frac{1}{2}}= \sum _{s=1}^N\beta _s\left( t_{k+\frac{1}{2}}\right) \left( \sum _{p=j_s}^{j_s+3}U_{p}^{k+\frac{1}{2}}\prod _{\stackrel {q=j_s} {q\ne {p}} }^{j_s+3}\frac{\eta _s-x_q}{x_p-x_q}\right) +\mu _2\left( t_{k+\frac{1}{2}}\right) +R_m^{k+\frac{1}{2}},\quad 0\le {k}\le {n-1},$$
(16)

and there exists a constant \({\hat{c}}_2\) such that

$$\begin{aligned} |R_0^{k+\frac{1}{2}}|\le {{\hat{c}}_2}\left( \tau ^2+h^4\right) ,\quad |R_m^{k+\frac{1}{2}}|\le {{\hat{c}}_2}\left( \tau ^2+h^4\right) ,\quad 0\le {k}\le {n-1}. \end{aligned}$$

Noticing the initial condition (5),

$$\begin{aligned} U_i^0=\varphi (x_i),\quad 0\le {i}\le {m}, \end{aligned}$$
(17)

omitting the small items \(R_i^{k+\frac{1}{2}}\;(0\le {i}\le {m})\) in the formula (9), (15) and (16), and replacing \(U_i^k\) by \(u_i^k,\) we obtain the following difference scheme:

$$\begin{aligned}&{\mathcal {A}}\delta _tu_i^{k+\frac{1}{2}}-a\delta _x^2u_i^{k+\frac{1}{2}}+b{\mathcal {A}}u_i^{k+\frac{1}{2}}={\mathcal {A}}f_i^{k+\frac{1}{2}},\quad 1\le {i}\le {m}-1,\;0\le {k}\le {n-1}, \end{aligned}$$
(18)
$$u_0^{k+\frac{1}{2}}=\sum _{r=1}^M\alpha _r\left( t_{k+\frac{1}{2}}\right) \left( \sum _{p=i_r}^{i_r+3}u_{p}^{k+\frac{1}{2}}\prod _{\stackrel {q=i_r} {q\ne {p}}}^{i_r+3}\frac{\xi _r-x_q}{x_p-x_q}\right) +\mu _1\left( t_{k+\frac{1}{2}}\right) ,\quad 0\le {k}\le {n-1},$$
(19)
$$u_m^{k+\frac{1}{2}}=\sum _{s=1}^N\beta _s\left( t_{k+\frac{1}{2}}\right) \left( \sum _{p=j_s}^{j_s+3}u_{p}^{k+\frac{1}{2}}\prod _{\stackrel {q=j_s} {q\ne {p}}}^{j_s+3}\frac{\eta _s-x_q}{x_p-x_q}\right) +\mu _2\left( t_{k+\frac{1}{2}}\right) ,\quad 0\le {k}\le {n-1}, $$
(20)
$$\begin{aligned}&u_i^0=\varphi \left( x_i\right) ,\quad 0\le {i}\le {m}. \end{aligned}$$
(21)

4 Prior Estimates

Lemma 4.1

The solution of (18)–(21) satisfies the following equality:

$$\begin{aligned} \begin{aligned}&\frac{1}{2\tau }\left( \left\| p\left( {\mathcal {A}}u^{k+1}\right) \right\|_0^2-\Vert p\left( {\mathcal {A}}u^k\right) \Vert_0^2\right) +a\,\left|p u^{k+\frac{1}{2}}\right|_1^2 +a\left\|u^{k+\frac{1}{2}}\right\|^2\\& -\frac{ah^2}{12}\left\|p\left( \delta _x^2u^{k+\frac{1}{2}}\right) \right\|_0^2 +b\left\|p\left( {\mathcal {A}}u^{k+\frac{1}{2}}\right) \right\|^2=h\sum _{i=1}^{m-1}p_i^2\left( {\mathcal {A}}f_i^{k+\frac{1}{2}}\right) \left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) \\& +\frac{a L}{2}\left[ \left( u_m^{k+\frac{1}{2}}\right) ^2+\left( u_0^{k+\frac{1}{2}}\right) ^2\right] ,\quad 0\le {k}\le {n-1}. \end{aligned} \end{aligned}$$
(22)

Proof

Multiplying equality (18) by \(h{\mathcal {A}}u_i^{k+\frac{1}{2}}\) and summing the result with respect to i from \(\eta\) to \(\xi ,\) we obtain

$$\begin{aligned} \begin{aligned}&h\sum _{i=\eta }^\xi \left( {\mathcal {A}}\delta _t u_i^{k+\frac{1}{2}}\right) \left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) -ah\sum _{i=\eta }^\xi \left( \delta _x^2u_i^{k+\frac{1}{2}}\right) \left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) +b h\sum _{i=\eta }^\xi \left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) ^2\\& =h\sum _{i=\eta }^\xi \left( {\mathcal {A}}f_i^{k+\frac{1}{2}}\right) \left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) ,\quad 1\le \eta \le \xi \le {m}-1,\;0\le {k}\le {n-1}. \end{aligned} \end{aligned}$$
(23)

We multiply the above equality by h and sum up for \(\xi\) from \(\eta\) to \(m-1,\) and then multiply the result by h and sum up for \(\eta\) from 1 to \(m-1\) to get

$$\begin{aligned} \begin{aligned}&h\sum _{i=1}^{m-1}p_i^2\left( {\mathcal {A}}\delta _t u_i^{k+\frac{1}{2}}\right) \left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) -ah\sum _{i=1}^{m-1}p_i^2\left( \delta _x^2u_i^{k+\frac{1}{2}}\right) \left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) \\& +b h\sum _{i=1}^{m-1}p_i^2\left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) ^2 =h\sum _{i=1}^{m-1}p_i^2\left( {\mathcal {A}}f_i^{k+\frac{1}{2}}\right) \left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) ,\quad 0\le {k}\le {n-1}. \end{aligned} \end{aligned}$$
(24)

Due to

$$\begin{aligned} \left( {\mathcal {A}}\delta _t u_i^{k+\frac{1}{2}}\right) \left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) =\frac{1}{2\tau }\left[ \left( {\mathcal {A}}u_i^{k+1}\right) ^2-\left( {\mathcal {A}}u_i^k\right) ^2\right] \end{aligned}$$

and

$$\begin{aligned} -ah\sum _{i=1}^{m-1}p_i^2\left( \delta _x^2u_i^{k+\frac{1}{2}}\right) \left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) =-ah\sum _{i=1}^{m-1}p_i^2\left( \delta _x^2u_i^{k+\frac{1}{2}}\right) u_i^{k+\frac{1}{2}}-\frac{ah^3}{12}\sum _{i=1}^{m-1}p_i^2\left( \delta _x^2u_i^{k+\frac{1}{2}}\right) ^2, \end{aligned}$$

we obtain

$$\begin{aligned} \begin{aligned}&\frac{1}{2\tau }\left( \left\| p\left( {\mathcal {A}}u^{k+1}\right) \right\| _0^2-\left\| p\left( {\mathcal {A}}u^k\right) \right\| _0^2\right) -ah\sum _{i=1}^{m-1}p_i^2\left( \delta _x^2u_i^{k+\frac{1}{2}}\right) u_i^{k+\frac{1}{2}}\\& -\frac{ah^2}{12}\left\| p\left( \delta _x^2u^{k+\frac{1}{2}}\right) \right\| _0^2 +b\left\| p\left( {\mathcal {A}}u^{k+\frac{1}{2}}\right) \right\| ^2=h\sum _{i=1}^{m-1}p_i^2\left( {\mathcal {A}}f_i^{k+\frac{1}{2}}\right) \left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) ,\quad 0\le {k}\le {n-1}. \end{aligned} \end{aligned}$$
(25)

Some calculation yields

$$\begin{aligned} \begin{aligned} -ah\sum _{i=1}^{m-1}p_i^2\left( \delta _x^2u_i^{k+\frac{1}{2}}\right) u_i^{k+\frac{1}{2}}&=\frac{ah}{2}\sum _{i=0}^{m-1}\left( p_i^2+p_{i+1}^2\right) \left( \delta _x u_{i+\frac{1}{2}}^{k+\frac{1}{2}}\right) ^2\\&\quad +\frac{a}{2}\sum _{i=0}^{m-1}\left( L-2x_i-h\right) \left[ \left( u_{i+1}^{k+\frac{1}{2}}\right) ^2-\left( u_i^{k+\frac{1}{2}}\right) ^2\right] \\&=a\,\left| p u^{k+\frac{1}{2}}\right| _1^2+a\left\| u^{k+\frac{1}{2}}\right\| ^2-\frac{a L}{2}\left[ \left( u_m^{k+\frac{1}{2}}\right) ^2+\left( u_0^{k+\frac{1}{2}}\right) ^2\right] . \end{aligned} \end{aligned}$$

Substituting the above equality into (25), we can get (22).

This completes the proof.

Theorem 4.1

Let\(\{u_i^k\;|\;0\le {i}\le {m},0\le {k}\le {n}\}\)be the solution of (18)–(21). Denote

$$\begin{aligned} \begin{aligned}&\alpha _0=\max _{0\le k\le n-1}\left( \frac{5}{4}\sum _{r=1}^M\left| \alpha _r\left( t_{k+\frac{1}{2}}\right) \right| \right) ^2,\quad \beta _0=\max _{0\le k\le n-1}\left( \frac{5}{4}\sum _{s=1}^N\left| \beta _s\left( t_{k+\frac{1}{2}}\right) \right| \right) ^2,\\&c_0=\min \left\{ \frac{\xi _1}{2}\left( L-\frac{\xi _1}{2}\right) ,\frac{\xi _M}{2}\left( L-\frac{\xi _M}{2}\right) , \frac{\eta _1}{2}\left( L-\frac{\eta _1}{2}\right) ,\frac{\eta _N}{2}\left( L-\frac{\eta _N}{2}\right) \right\} ,\\&c_1=\min \left\{\xi _M-\xi _1,\eta _N-\eta _1\right\},\\&c_2=\frac{1}{2}+\frac{24\left( \alpha _0+\beta _0\right) a L}{5}\left( \frac{6\left( \alpha _0+\beta _0\right) L}{c_0^2}+\frac{2}{c_0c_1}\right) ,\qquad c_3=\max \{1,4a L\}. \end{aligned} \end{aligned}$$
(26)

Whenhand\(\tau\)are small enough, we have

$$\begin{aligned} \begin{aligned} \left\| p\left( {\mathcal {A}}u^{k+1}\right) \right\| _0^2&\le e^{3c_2\left( k+1\right) \tau }\left[ \left\| p\left( {\mathcal {A}}u^0\right) \right\| _0^2+\frac{3c_3}{2}\tau \sum _{l=0}^k\left( \left\| p\left( {\mathcal {A}}f^{l+\frac{1}{2}}\right) \right\| _0^2\right. \right. \\&\quad \left. \left. +\,\mu _1^2\left( t_{l+\frac{1}{2}}\right) +\mu _2^2\left( t_{l+\frac{1}{2}}\right) \right) \right] ,\;0\le {k}\le {n-1}. \end{aligned} \end{aligned}$$
(27)

Proof

By Lemma 4.1 and inequalities

$$\begin{aligned} \begin{aligned}&h\sum _{i=1}^{m-1}p_i^2\left( {\mathcal {A}}f_i^{k+\frac{1}{2}}\right) \left( {\mathcal {A}}u_i^{k+\frac{1}{2}}\right) \le \frac{1}{2}\left\| p\left( {\mathcal {A}}u^{k+\frac{1}{2}}\right) \right\| _0^2+\frac{1}{2}\left\| p\left( {\mathcal {A}}f^{k+\frac{1}{2}}\right) \right\| _0^2,\\&\quad \frac{ah^2}{12}\left\| p\left( \delta _x^2u^{k+\frac{1}{2}}\right) \right\| _0^2\le \frac{ah}{6}\sum _{i=1}^{m-1}p_i^2\left[ \left( \delta _x u_{i+\frac{1}{2}}^{k+\frac{1}{2}}\right) ^2+\left( \delta _x u_{i-\frac{1}{2}}^{k+\frac{1}{2}}\right) ^2\right] \le \frac{a}{3}|p u^{k+\frac{1}{2}}|_1^2,\\ \end{aligned} \end{aligned}$$

we have

$$\begin{aligned}&\frac{1}{2\tau }\left( \left\| p\left( {\mathcal {A}}u^{k+1}\right) \right\| _0^2-\left\| p\left( {\mathcal {A}}u^k\right) \right\| _0^2\right) +\frac{2a}{3}\,|p u^{k+\frac{1}{2}}|_1^2\nonumber \\& \le \frac{1}{2}\left\| p\left( {\mathcal {A}}u^{k+\frac{1}{2}}\right) \right\| _0^2+\frac{1}{2}\left\| p\left( {\mathcal {A}}f^{k+\frac{1}{2}}\right) \right\| _0^2+\frac{a L}{2}\left[ \left( u_0^{k+\frac{1}{2}}\right) ^2+\left( u_m^{k+\frac{1}{2}}\right) ^2\right] . \end{aligned}$$
(28)

According to Lemmas 2.2 and 2.3, when \(4h\le \min \{\xi _1,L-\xi _M,\eta _1,L-\eta _n,\xi _M-\xi _1,\eta _N-\eta _1\},\) we have

$$\begin{aligned} \begin{aligned} \frac{1}{2}\left( u_0^{k+\frac{1}{2}}\right) ^2&\le \alpha _0\left\| u^{k+\frac{1}{2}}\right\| _{\infty ,[x_{i_1},x_{i_M+3}]}^2+\mu _1^2\left( t_{k+\frac{1}{2}}\right) \\&\le \alpha _0\varepsilon |p u^{k+\frac{1}{2}}|_1^2+\alpha _0\left( \frac{1}{c_0^2\varepsilon }+\frac{2}{c_0\left( x_{i_M+3}-x_{i_1}\right) }\right) \left\| p u^{k+\frac{1}{2}}\right\| _0^2+\mu _1^2\left( t_{k+\frac{1}{2}}\right) \\&\le \alpha _0\varepsilon \left| p u^{k+\frac{1}{2}}\right| _1^2+\frac{12\alpha _0}{5}\left( \frac{1}{c_0^2\varepsilon }+\frac{2}{c_0\left( \xi _M-\xi _1\right) }\right) \left\| p\left( {\mathcal {A}}u^{k+\frac{1}{2}}\right) \right\| _0^2\\&\quad +\frac{\alpha _0h^2L}{6}\left( \frac{1}{c_0^2\varepsilon }+\frac{2}{c_0\left( \xi _M-\xi _1\right) }\right) \left[ \left( u_0^{k+\frac{1}{2}}\right) ^2+\left( u_m^{k+\frac{1}{2}}\right) ^2\right] +\mu _1^2\left( t_{k+\frac{1}{2}}\right) ,\\ \frac{1}{2}\left( u_m^{k+\frac{1}{2}}\right) ^2&\le \beta _0\left\| u^{k+\frac{1}{2}}\right\| _{\infty ,[x_{j_1},x_{j_N+3}]}^2+\mu _2^2\left( t_{k+\frac{1}{2}}\right) \\&\le \beta _0\varepsilon \left| p u^{k+\frac{1}{2}}\right| _1^2+\beta _0\left( \frac{1}{c_0^2\varepsilon }+\frac{2}{c_0\left( x_{j_N+3}-x_{j_1}\right) }\right) \left\| p u^{k+\frac{1}{2}}\right\| _0^2+\mu _2^2\left( t_{k+\frac{1}{2}}\right) \\&\le \beta _0\varepsilon \left| p u^{k+\frac{1}{2}}\right| _1^2+\frac{12\beta _0}{5}\left( \frac{1}{c_0^2\varepsilon }+\frac{2}{c_0\left( \eta _N-\eta _1\right) }\right) \left\| p\left( {\mathcal {A}}u^{k+\frac{1}{2}}\right) \right\| _0^2\\&\quad +\frac{\beta _0h^2L}{6}\left( \frac{1}{c_0^2\varepsilon }+\frac{2}{c_0\left( \eta _N-\eta _1\right) }\right) \left[ \left( u_0^{k+\frac{1}{2}}\right) ^2+\left( u_m^{k+\frac{1}{2}}\right) ^2\right] +\mu _2^2\left( t_{k+\frac{1}{2}}\right) . \end{aligned} \end{aligned}$$

Taking \(\varepsilon =1/(6L(\alpha _0+\beta _0)),\) we have

$$\begin{aligned} \begin{aligned}&\left[ \frac{1}{2}-\frac{\left( \alpha _0+\beta _0\right) h^2L}{6}\left( \frac{6\left( \alpha _0+\beta _0\right) L}{c_0^2}+\frac{2}{c_0c_1}\right) \right] \left[ \left( u_0^{k+\frac{1}{2}}\right) ^2+\left( u_m^{k+\frac{1}{2}}\right) ^2\right] \\& \le \frac{1}{6L}\left| p u^{k+\frac{1}{2}}\right| _1^2+\frac{12\left( \alpha _0+\beta _0\right) }{5}\left( \frac{6\left( \alpha _0+\beta _0\right) L}{c_0^2}+\frac{2}{c_0c_1}\right) \left\| p\left( {\mathcal {A}}u^{k+\frac{1}{2}}\right) \right\| _0^2\\&\qquad +\mu _1^2\left( t_{k+\frac{1}{2}}\right) +\mu _2^2\left( t_{k+\frac{1}{2}}\right) . \end{aligned} \end{aligned}$$

When \(h<\frac{c_0}{2}\,\sqrt{\frac{3c_1}{(\alpha _0+\beta _0)L[3c_1(\alpha _0+\beta _0)L+c_0]\,}}\,,\) we get

$$\begin{aligned} \left( u_0^{k+\frac{1}{2}}\right) ^2+\left( u_m^{k+\frac{1}{2}}\right) ^2\le \frac{2}{3L}\left| p u^{k+\frac{1}{2}}\right| _1^2&+\frac{48\left( \alpha _0+\beta _0\right) }{5} \left( \frac{6\left( \alpha _0+\beta _0\right) L}{c_0^2}+\frac{2}{c_0c_1}\right) \left\| p\left( {\mathcal {A}}u^{k+\frac{1}{2}}\right) \right\| _0^2\\&+4\mu _1^2\left( t_{k+\frac{1}{2}}\right) +4\mu _2^2\left( t_{k+\frac{1}{2}}\right) . \end{aligned}$$

Substituting the above inequality into (28), we obtain

$$\begin{aligned} \begin{aligned}&\frac{1}{2\tau }\left( \left\| p\left( {\mathcal {A}}u^{k+1}\right) \right\| _0^2-\left\| p\left( {\mathcal {A}}u^k\right) \right\| _0^2\right) \\& \le \frac{c_2}{2}\left( \left\| p\left( {\mathcal {A}}u^k\right) \right\| _0^2+\left\| p\left( {\mathcal {A}}u^{k+1}\right) \right\| _0^2\right) +\frac{c_3}{2}\left[ \left\| p\left( {\mathcal {A}}f^{k+\frac{1}{2}}\right) \right\| _0^2+\mu _1^2\left( t_{k+\frac{1}{2}}\right) +\mu _2^2\left( t_{k+\frac{1}{2}}\right) \right] . \end{aligned} \end{aligned}$$

That is

$$\begin{aligned} \left( 1-c_2\tau \right) \left\| p\left( {\mathcal {A}}u^{k+1}\right) \right\| _0^2\le & {} \left( 1+c_2\tau \right) \left\| p\left( {\mathcal {A}}u^k\right) \right\| _0^2\nonumber \\&+c_3\tau \left[ \left\| p\left( {\mathcal {A}}f^{k+\frac{1}{2}}\right) \right\| _0^2+\mu _1^2\left( t_{k+\frac{1}{2}}\right) +\mu _2^2\left( t_{k+\frac{1}{2}}\right) \right] . \end{aligned}$$
(29)

When \(c_2\tau \le 1/3,\) we have

$$\begin{aligned} \left\| p\left( {\mathcal {A}}u^{k+1}\right) \right\| _0^2\le & {} \left( 1+3c_2\tau \right) \left\| p\left( {\mathcal {A}}u^k\right) \right\| _0^2+\frac{3}{2}c_3\tau \left[ \left\| p\left( {\mathcal {A}}f^{k+\frac{1}{2}}\right) \right\| _0^2\right. \\&\left. +\,\mu _1^2\left( t_{k+\frac{1}{2}}\right) +\mu _2^2\left( t_{k+\frac{1}{2}}\right) \right] ,\quad 0\le k\le n-1. \end{aligned}$$

By Lemma 2.6, we obtain (27).

This completes the proof.

5 The Unique Solvability, Stability and Convergence

5.1 Unique Solvability

Theorem 5.1

Difference scheme (18)–(21) has a unique solution.

Proof

The difference scheme (18)–(21) is a linear system of algebraic equations. Let \(u^k=(u_0^k,u_1^k,\ldots ,u_m^k).\) According to (21), we obtain the value of \(u^0.\) If the value \(u^k\) of the k-th time level is obtained, then we can obtain the value of \(u^{k+1}\) through (18)–(20). Consider the homogeneous system about \(u^{k+1}\):

$$\begin{aligned}&\frac{2}{\tau }{\mathcal {A}}u_i^{k+1}-a\delta _x^2u_i^{k+1}+b{\mathcal {A}}u_i^{k+1}=0,\quad 1\le {i}\le {m}-1, \end{aligned}$$
(30)
$$u_0^{k+1}=\sum _{r=1}^M\alpha _r\left( t_{k+\frac{1}{2}}\right) \left( \sum _{p=i_r}^{i_r+3}u_{p}^{k+1}\prod _{\stackrel {q=i_r} {q\ne {p}}}^{i_r+3}\frac{\xi _r-x_q}{x_p-x_q}\right) , $$
(31)
$$u_m^{k+1}=\sum _{s=1}^N\beta _s\left( t_{k+\frac{1}{2}}\right) \left( \sum _{p=j_s}^{j_s+3}u_{p}^{k+1}\prod _{\stackrel{q=j_s} {q\ne {p}}}^{j_s+3}\frac{\eta _s-x_q}{x_p-x_q}\right). $$
(32)

According to Lemma 4.1 and similar to the derivation of (29), we get the result

$$\begin{aligned} (1-c_2\tau )\left\| p({\mathcal {A}}u^{k+1})\right\| _0^2\le 0. \end{aligned}$$

When \(\tau <1/c_2,\) we have \(\Vert p({\mathcal {A}}u^{k+1})\Vert _0^2=0,\) that implies that

$$\begin{aligned} {\mathcal {A}}u_i^{k+1}=0,\quad 1\le i\le m-1. \end{aligned}$$

Then, it follows from (30) that

$$\begin{aligned} \delta _x^2u_i^{k+1}=0, \quad 1\le {i}\le {m}-1. \end{aligned}$$

Both above equalities yield that

$$\begin{aligned} u_i^{k+1}={\mathcal {A}}u_i^{k+1}-\frac{h^2}{12}\delta _x^2u_i^{k+1}=0, \quad 1\le {i}\le {m}-1. \end{aligned}$$

Combining with (31) and (32), we know \(u_i^{k+1}=0,\,0\le i\le m.\) Thus, the homogeneous system only has a trivial solution.

This completes the proof.

5.2 Stability and Convergence

According to Theorem 4.1, we can obtain the following result easily.

Theorem 5.2

The difference scheme (18)–(21) is stable to the initial value and the right term in the sense that: let\(\{u_i^k\;|\;0\le {i}\le {m},0\le {k}\le {n}\}\)be the solution of difference scheme (18)–(21), then we have

$$\begin{aligned} \left\| p\left( {\mathcal {A}}u^{k+1}\right) \right\| _0^2\le & {} e^{3c_2\left( k+1\right) \tau }\left[ \left\| p\left( {\mathcal {A}}u^0\right) \right\| _0^2+\frac{3c_3}{2}\tau \sum _{l=0}^k\left( \left\| p\left( {\mathcal {A}}f^{l+\frac{1}{2}}\right) \right\| _0^2\right. \right. \\&\left. \left. +\,\mu _1^2\left( t_{l+\frac{1}{2}}\right) +\mu _2^2\left( t_{l+\frac{1}{2}}\right) \right) \right] ,\;0\le {k}\le {n-1}, \end{aligned}$$

where\(c_2\)and\(c_3\)are defined in (26).

Theorem 5.3

The finite-difference scheme (18)–(21) is convergent with the convergence order of\(O(\tau ^2+h^4)\)in the weighted norm.

Proof

Let

$$\begin{aligned} e_i^k=U_i^k-u_i^k,\quad 0\le i\le m, \; 0\le k\le n. \end{aligned}$$

Then, subtracting (18)–(21) from (9), (15), (16) and (17) yields the error equations

$$\begin{aligned}&{\mathcal {A}}\delta _te_i^{k+\frac{1}{2}}-a\delta _x^2e_i^{k+\frac{1}{2}}+b{\mathcal {A}}e_i^{k+\frac{1}{2}}=R_i^{k+\frac{1}{2}},\quad 1\le {i}\le {m}-1,\; 0\le {k}\le {n-1}, \end{aligned}$$
(33)
$$e_0^{k+\frac{1}{2}}=\sum _{r=1}^M\alpha _r\left( t_{k+\frac{1}{2}}\right) \left( \sum _{p=i_r}^{i_r+3}e_{p}^{k+\frac{1}{2}}\prod _{\stackrel{q=i_r} {q\ne {p}}}^{i_r+3}\frac{\xi _r-x_q}{x_p-x_q}\right) +R_0^{k+\frac{1}{2}},\quad 0\le {k}\le {n-1}, $$
(34)
$$;e_m^{k+\frac{1}{2}}=\sum _{s=1}^N\beta _s\left( t_{k+\frac{1}{2}}\right) \left( \sum _{p=j_s}^{j_s+3}e_{p}^{k+\frac{1}{2}}\prod _{\stackrel{q=j_s} {q\ne {p}}}^{j_s+3}\frac{\eta _s-x_q}{x_p-x_q}\right) +R_m^{k+\frac{1}{2}},\quad 0\le {k}\le {n-1},$$
(35)
$$\begin{aligned}&e_i^0=0,\quad 0\le {i}\le {m}. \end{aligned}$$
(36)

From Theorem 4.1, we obtain

$$\begin{aligned} \left\| p\left( {\mathcal {A}}e^{k+1}\right) \right\| _0^2\le \frac{3c_3}{2}{e}^{3c_2\left( k+1\right) \tau }\tau \sum _{j=0}^k\left( \left\| p\left( {\mathcal {A}}R^{j+\frac{1}{2}}\right) \right\| _0^2+\left( R_0^{k+\frac{1}{2}}\right) ^2+\left( R_m^{k+\frac{1}{2}}\right) ^2\right) =O\left( \left( \tau ^2+h^4\right) ^2\right) . \end{aligned}$$

This completes the proof of the theorem.

6 A Compact Difference Scheme for Heat Equations with Variable Coefficients

We have discussed a compact difference scheme for the heat equation with the constant coefficients in above sections. In this section, we will consider the heat equation with variable coefficients in [1]:

$$\begin{aligned} w_t=a(x)w_{xx}+b(x)w_x+{\bar{c}}(x,t)w+g(x,t),\quad 0<x<L,\;0<t\le {T}. \end{aligned}$$

Let

$$\begin{aligned} w(x,t)=e^{k(x)}u(x,t),\quad k(x)=-\frac{1}{2}\int _0^x\frac{b(s)}{a(s)}\mathrm ds. \end{aligned}$$

Then, the function u(xt) satisfies that

$$\begin{aligned} \frac{1}{a(x)}u_t=u_{xx}+c(x,t)u+f(x,t) \end{aligned},$$

where \(c(x,t)=k''(x)+(k'(x))^2+b(x)k'(x)/a(x)+{\bar{c}}(x,t)/a(x),\;f(x,t)=e^{-k(x)}g(x,t).\) The convection term disappears now. Thus, we consider the multi-point boundary value problem of the heat equation with variable coefficients:

$$\begin{aligned}&q\left( x\right) u_t=u_{xx}+c\left( x,t\right) u+f\left( x,t\right) ,\quad 0<x<L,\;0<t\le {T}, \end{aligned}$$
(37)
$$\begin{aligned}&u\left( 0,t\right) =\sum _{r=1}^M\alpha _r\left( t\right) u\left( \xi _r,t\right) +\mu _1\left( t\right) ,\nonumber \\&{u}\left( L,t\right) =\sum _{s=1}^N\beta _s\left( t\right) u\left( \eta _s,t\right) +\mu _2\left( t\right) ,\quad 0<t\le {T}, \end{aligned}$$
(38)
$$\begin{aligned}&u\left( x,0\right) =\varphi \left( x\right) ,\quad 0\le {x}\le {L}. \end{aligned}$$
(39)

Similar to the establishment of (18)–(21) for problem (3)–(5), we present a compact difference scheme for (37)–(39) as follows:

$$\begin{aligned}&{\mathcal {A}}\left( q\left( x_i\right) \delta _tu_i^{k+\frac{1}{2}}\right) -\delta _x^2u_i^{k+\frac{1}{2}}+{\mathcal {A}}\left( cu\right) _i^{k+\frac{1}{2}}={\mathcal {A}}f_i^{k+\frac{1}{2}},\quad 1\le {i}\le {m}-1,\;0\le {k}\le {n-1}, \end{aligned}$$
(40)
$$u_0^{k+\frac{1}{2}}=\sum _{r=1}^M\alpha _r\left( t_{k+\frac{1}{2}}\right) \left( \sum _{p=i_r}^{i_r+3}u_{p}^{k+\frac{1}{2}}\prod _{\stackrel{q=i_r} {q\ne {p}}}^{i_r+3}\frac{\xi _r-x_q}{x_p-x_q}\right) +\mu _1\left( t_{k+\frac{1}{2}}\right) ,\quad 0\le {k}\le {n-1}, $$
(41)
$$u_m^{k+\frac{1}{2}}=\sum _{s=1}^N\beta _s\left( t_{k+\frac{1}{2}}\right) \left( \sum _{p=j_s}^{j_s+3}u_{p}^{k+\frac{1}{2}}\prod _{\stackrel{q=j_s} {q\ne {p}}}^{j_s+3}\frac{\eta _s-x_q}{x_p-x_q}\right) +\mu _2\left( t_{k+\frac{1}{2}}\right) , \quad 0\le {k}\le {n-1},$$
(42)
$$\begin{aligned}&u_i^0=\varphi \left( x_i\right) ,\quad 0\le {i}\le {m}. \end{aligned}$$
(43)

The truncation errors of (40)–(42) are all \(O(\tau ^2+h^4).\) The proof of solvability, stability and convergence of (40)–(43) is similar to that of (18)–(21), so we do not repeat it here and just show a numerical example in Sect. 7.

7 Numerical Tests

Example 1

Use the compact difference scheme (18)–(21) to solve the following problem

$$\left\{ \begin{array}{ll} {\frac{\partial {u}}{\partial {t}}-\frac{\partial ^2u}{\partial {x^2}}+u=-e^{x-t}, \qquad 0<x<1,\;0<t\le 1,} &{} \\ u\left( 0,t\right) =0.2\times \left[ u\left( 0.215,t\right) +u\left( 0.345,t\right) +u\left( 0.455,t\right) +u\left( 0.5,t\right) +u\left( 0.785,t\right) \right] \\ \quad +\left[ 1-0.2\times \left( e^{0.215}+e^{0.345}+e^{0.455}+e^{0.5}+e^{0.785}\right) \right] e^{-t},\qquad 0<t\le 1, & {} \\ u\left( 1,t\right) =0.4\times \left[ u\left( 0.375,t\right) +u\left( 0.435,t\right) +u\left( 0.575,t\right) +u\left( 0.695,t\right) \right] \\ \quad +\left[ e-0.4\times \left( e^{0.375}+e^{0.435}+e^{0.575}+e^{0.695}\right) \right] e^{-t},\qquad 0<t\le 1, &{} \\ {u\left( x,0\right) =e^x,\quad 0\le {x}\le 1.} & {} \end{array}\right.$$

The exact solution is \(u(x,t)=e^{x-t}.\) Define

$$\begin{aligned} E(h,\tau )=\max _{\begin{array}{c} 1\le {k}\le {n} \end{array}}\left\| p({\mathcal {A}}(U^k-u^k))\right\| _0. \end{aligned}$$

Table 1 presents the errors in a weighted \(L^2\) norm when we take different space step sizes. When the time step size is fixed to 1/16 000 and the space step size shrinks, the spatial convergence order is 4. Table 2 lists the errors in a weighted \(L^2\) norm when we take different time step sizes. When the space step is fixed to 1/1 600 and the time step shrinks, the temporal convergence order is 2. Table 3 provides the errors in a weighted \(L^2\) norm when we take different space and time step sizes. The numerical results are consistent with the theoretical analysis of convergence and stability.

Table 1 The spatial convergence order of difference scheme (18)–(21) (\(\tau =1/16\,000\))
Table 2 The temporal convergence order of difference scheme (18)–(21) (\(h=1/1\,600\))
Table 3 The spatial and temporal convergence order of difference scheme (18)–(21)

Example 2

Use the compact difference scheme (40)–(43) to solve the following problem:

$$\left\{\begin{aligned}&e^{-x}\frac{\partial {u}}{\partial {t}}-\frac{\partial ^2u}{\partial {x^2}}+e^{t}u=e^{x}-e^{-t}-e^{x-t},\quad 0<x<1,\;0<t\le 1, \\&u(0,t)=0.2\times \left[ u(0.215,t)+u(0.345,t)+u(0.455,t)+u(0.5,t)+u(0.785,t)\right] \\&\quad +\left[ 1-0.2\times \left( e^{0.215}+e^{0.345}+e^{0.455}+e^{0.5}+e^{0.785}\right) \right] e^{-t},\quad 0<t\le 1, \\&u(1,t)=0.4\times \left[ u(0.375,t)+u(0.435,t)+u(0.575,t)+u(0.695,t)\right] \\&\quad +\left[ e-0.4\times \left( e^{0.375}+e^{0.435}+e^{0.575}+e^{0.695}\right) \right] e^{-t},\quad 0<t\le 1, \\&u(x,0)=e^x,\quad 0\le {x}\le 1. \end{aligned}\right.$$

The exact solution is \(u(x,t)=e^{x-t}.\)

Table 4 presents the errors in a weighted \(L^2\) norm when we take different space step sizes with fixing time step size, which shows the spatial convergence order is 4. Table 5 lists the errors in a weighted \(L^2\) norm when we take different time step sizes with fixing space step, which presents the temporal convergence order is 2. Table 6 provides the errors in a weighted \(L^2\) norm when we take different space and time step sizes. The numerical results are consistent with the truncation errors.

Table 4 The spatial convergence order of difference scheme (40)–(43) (\(\tau =1/16\,000\))
Table 5 The temporal convergence order of difference scheme (40)–(43) (\(h=1/1\,600\))
Table 6 The spatial and temporal convergence order of difference scheme (40)–(43)

8 Conclusion

In this article, a compact difference scheme is constructed to solve the multi-point boundary value problem of the heat conduction equation with constant coefficients. Using the energy method, the prior estimate is obtained and the unique solvability, stability and convergence are proved rigorously. Because of the complexity of the multi-point boundary conditions, the convergence order \(O(\tau ^2+h^4)\) is obtained only in a weighted \(L^2\) norm. Besides, a compact difference scheme is also constructed for the problem with variable coefficients. Numerical examples are provided to confirm the accuracy of the difference scheme, which are consistent with the theoretical analysis. In the future, efforts will be taken to perform an analysis on the difference scheme in \(L^2\) norm and in \(L_\infty\) norm.