1 Introduction

In this paper, we propose a novel algorithm for the numerical solution of the biharmonic equation in an interval, involving a potential, as follows:

$$\begin{aligned} \left( \frac{d}{dx}\right) ^4u(x)+c(x)u(x)=\phi (x),\quad 0<x<1, \end{aligned}$$
(1.1)
$$\begin{aligned} u(0)=u^{\prime }(0)=u(1)=u^{\prime }(1)=0. \end{aligned}$$
(1.2)

Here, the function \(\phi (x)\) and the potential c(x) are given functions.

It is assumed that zero is not an eigenvalue of the operator \(\left( \frac{d}{dx}\right) ^4+c(x)\) so that (1.1) has a unique solution. That can always be achieved by a suitable constant shift of the potential.

We use a high-order finite-difference scheme, based on the Hermitian derivative and the resulting “Discrete Biharmonic Operator” (DBO) as outlined in the paper [10]. In particular, the scheme used here is not new, but the algorithm offered for the resolution of the ensuing linear system is new, leading to an optimal O(N) complexity. This is achieved by an application of the theory of quasiseparable matrices as is explained below. The implementation of the scheme leads to a system of linear algebraic equations

$$\begin{aligned} \left( \begin{array}{cc}A&{}B\\ C&{}D\end{array}\right) \left( \begin{array}{c}{\mathfrak u}\\ {\mathfrak u}_x\end{array}\right) =\left( \begin{array}{c}{\mathfrak y}\\ 0\end{array}\right) \end{aligned}$$
(1.3)

with \(N\times N\) tridiagonal matrices matrices ABCD and a given N-dimensional column \({\mathfrak y}\). Here, N is the number of the nodes in the grid. Assuming that the matrix D is invertible, the \(2N\times 2N\) system is reduced to \(N\times N\) system

$$\begin{aligned} Z{\mathfrak u}=(A-BD^{-1}C){\mathfrak u}={\mathfrak y}. \end{aligned}$$
(1.4)

The fact that the discrete solution \(\mathfrak {u}\) converges (as \(N\rightarrow \infty \)) to the exact solution u(x) has been established in [3].

The paper [2] dealt with the case of zero potential \(c(x)\equiv 0.\) In this case, the proposed algorithm was based on the FFT transform and led to an \(O(N\log N)\) complexity algorithm. In a more general case of a nonzero potential, the matrix A is not Toeplitz and so the FFT-based algorithm does not work. This case is assumed to be treated via perturbation theory.

In the present paper, we suggest a completely different paradigm for the algebraic treatment of the system (1.3). It is based on the theory of quasiseparable representations of matrices and their inversion. It permits the incorporation of a general potential. We refer to the treatise [8] for a detailed exposition of this theory.

Here, we need to consider a rather special case of the abovementioned theory. We show that in the context of the system (1.3) with a general symmetric tridiagonal A, the matrix of the problem Z belongs to a special class of rank structured matrices. More precisely, the part below the first subdiagonal in the matrix Z (\(j\le i-2\)) is given via a product of scalar parameters that can be readily calculated.

The full matrix is given by the following formulas:

$$\begin{aligned} Z_{ij}=\left\{ \begin{array}{ll} d_i,&{}1\le j=i\le N,\\ \delta _{i-1},&{}1\le j=i-1\le N-1,\\ p(i-1)q(i-2),&{}3\le i\le N,\;j=i-2,\\ p(i-1) a(i-2)\cdots a(j+1)q(j),&{}1\le j\le i-3\le N-3.\end{array} \right. \end{aligned}$$
(1.5)

The parameters in the RHS of (1.5) are computed in a straightforward way from the given matrices \(A,\,B,\,C,\,D\,\,\) [7, Algorithm 6.1]. Indeed, this is the “heart of the algorithm” proposed here.

In fact, assuming that Z is a strongly regular matrix, the parameters in (1.5) are readily implemented in expressing Z as a classical “Left\(\cdot \) Diag\(\cdot \)Right” product

$$\begin{aligned} Z=(I+L)\Gamma (I+L^t), \end{aligned}$$
(1.6)

where \(\Gamma \) is an invertible diagonal matrix and L is a lower triangular matrix with zero diagonal. Based on this factorization, the solution to (1.4) follows a well-known procedure.

Overall, we obtain a linear O(N) complexity algorithm for any nonconstant potential. We present some numerical tests that corroborate the linearity and the good accuracy of our algorithm for a variety of potentials. The condition that Z is strongly regular is not necessary. In our next publications, we intend to present another inversion algorithm free of this restriction. Surely this alternative algorithm is longer and more complicated than the algorithm of the present paper.

The paper consists of thirteen sections. In Section 2, we present the formulation of the boundary value problem, describe the Hermitian finite-difference operators, and obtain the discrete analog of the basic equation. In Section 3, we recall the basic facts pertaining to the quasiseparable representation which is the foundation of the algorithm. In Section 4, we reduce the system (1.3) to matrix equation in the class of rank structured matrices. In Section 5, we present an inversion algorithm for the tridiagonal matrix D, which is the main tool in the quasiseparable frame. The proof is postponed to Appendix 1 in Section 13. Section 6 is in fact the central part of the paper. Here, we show that the part \(i>j+1\) of the matrix Z of the problem admits the representation (1.5) and derive an algorithm to compute the parameters of the representation (1.5) ( by means of quasiseparable generators) as well as the elements of the diagonal and subdiagonal of the symmetric matrix Z. These data are precisely the input for the “Left\(\cdot \) Diag\(\cdot \)Right” factorization algorithm in [7, Theorem 7.1]. The construction of (1.6) is described in Section 7, subject to the assumption that Z is a strongly regular matrix. Based on this factorization, we recall in Section 8 the classical procedure for solving (1.4) when Z is given by (1.6). In Section 9, we summarize the final complete algorithm in the form as it is used in the numerical tests. In Section 10, we consider the case of zero potential for which the Green function of the problem is explicitly available, see (10.3).

Section 11 contains the results of numerical experiments. Appendix 1 (Section 13) contains the proof of the inversion algorithm for the tridiagonal matrix D. Finally, in Appendix 2 (Section 14), we present for completeness the basic foundation of the quasiseparable representation of matrices.

NOTATION

Submatrices in this paper are indicated in MATLAB style, i.e., for a matrix A, A(m : nt : s) selects rows m to n and columns t to s. A colon without an index range selects all the rows and columns, for instance, for an \(m\times n\) matrix B, we have \(B(:,j)=B(1:m,j)\) for any j with \(1\le j\le n\).

2 The model Dirichlet problem and the discretization

We consider the numerical solution of the biharmonic equation on an interval

$$\begin{aligned} \left( \frac{d}{dx}\right) ^4u(x)+c(x)u(x)=\phi (x),\quad 0<x<1 \end{aligned}$$
(2.1)

subject to Dirichlet boundary conditions

$$\begin{aligned} u(0)=u^{\prime }(0)=u(1)=u^{\prime }(1)=0. \end{aligned}$$
(2.2)

Here, \(\phi (x)\) is a continuous function. By “solution of the problem” (2.1)-(2.2), we mean a continuous function u(x) on the segment [0, 1] having a fourth-order derivative \(u^{(4)}(x)\) in [0, 1].

To get the numerical solution of the problem (2.1)-(2.2), we start with the definition of the grid on the interval. In this paper, we use a uniform grid

$$ x_j=jh,\quad 0\le j\le N+1, \quad h=\frac{1}{N+1}. $$

We denote the values of the potential and the right part of (2.1) on the grid by

$$ c_j=c(x_j),\;\phi _j=\phi (x_j),\quad j=0,\dots ,N+1, $$

and form the \(N+2\)-dimensional columns \(c=\textrm{col}(c_j)_{j=0}^{N+1},\;\phi =\textrm{col}(\phi _j)_{j=0}^{N+1}\). The corresponding unknown values of the solution u(x) and its derivative \(u^{\prime }(x)\) on this grid are displayed as the columns of the size \(N+2\) as \(u^*=\textrm{col}(u(x_j))_{j=0}^{N+1}\) and \((u^*)^{\prime }=\textrm{col}(u^{\prime }(x_j))_{j=0}^{N+1}\).

In the numerical solution of the problem, we are looking for an approximation of the solution, i.e., an \(N+2\)-dimensional vector column \(\tilde{u}=\textrm{col}({\mathfrak u}_j)_{j=0}^{N+1}\), and of its derivatives, i.e., a vector \(\tilde{u}^{\prime }=\textrm{col}(({\mathfrak u}_x)_j)_{j=0}^{N+1}\). We apply here an approach suggested in the paper [4, Appendix] and the monograph [10]. In accordance with these references, the values \({\mathfrak u}_j,({\mathfrak u}_x)_j\) are determined via a system of linear algebraic equations

$$\begin{aligned} \begin{gathered} (2{\mathfrak u}_j-{\mathfrak u}_{j+1}-{\mathfrak u}_{j-1})+ \frac{h}{2}(({\mathfrak u}_x)_{j+1}-({\mathfrak u}_x)_{j-1})+ \frac{h^4}{12}c_j {\mathfrak u}_{j}= \frac{h^4}{12}\phi _j,\quad 1\le j\le N,\\ h^2\left( \frac{1}{6}({\mathfrak u}_x)_{j-1}+\frac{2}{3}({\mathfrak u}_x)_j+ \frac{1}{6}({\mathfrak u}_x)_{j+1}\right) = \frac{h}{2}({\mathfrak u}_{j+1}-{\mathfrak u}_{j-1}), \quad 1\le j\le N,\\ {\mathfrak u}_0={\mathfrak u}_{N+1}=({\mathfrak u}_x)_0= ({\mathfrak u}_x)_{N+1}=0. \end{gathered} \end{aligned}$$
(2.3)

The boundary value problem (2.1), (2.2) is thus reduced to a problem in numerical linear algebra.

The last equalities in (2.3) surely follow from the boundary value conditions (2.2). Following (2.3), we set \(h_0=\frac{h^4}{12}\) and define the \(N\times N\) matrices

$$\begin{aligned} A_0=\left( \begin{array}{cccccc}2+h_0c_1&{}-1&{}0&{}\dots &{}0&{}0\\ -1&{}2+h_0c_2&{}-1&{}\dots &{}0&{}0\\ \vdots &{}\vdots &{}\vdots &{}\ddots &{}\vdots \\ 0&{}0&{}0&{}\dots &{}2+h_0c_{N-1}&{}-1\\ 0&{}0&{}0&{}\dots &{}-1&{}2+h_0c_N\end{array}\right) , \end{aligned}$$
(2.4)
$$\begin{aligned} B_0=\left( \begin{array}{cccccc}0&{}1&{}0&{}\dots &{}0&{}0\\ -1&{}0&{}1&{}\dots &{}0&{}0\\ \vdots &{}\vdots &{}\vdots &{}\ddots &{}\vdots \\ 0&{}0&{}0&{}\dots &{}0&{}1\\ 0&{}0&{}0&{}\dots &{}-1&{}0\end{array}\right) ,\; C_0=\left( \begin{array}{cccccc}0&{}-1&{}0&{}\dots &{}0&{}0\\ 1&{}0&{}-1&{}\dots &{}0&{}0\\ \vdots &{}\vdots &{}\vdots &{}\ddots &{}\vdots \\ 0&{}0&{}0&{}\dots &{}0&{}-1\\ 0&{}0&{}0&{}\dots &{}1&{}0\end{array}\right) , \end{aligned}$$
(2.5)
$$\begin{aligned} D_0=\left( \begin{array}{cccccc}\frac{2}{3}&{}\frac{1}{6}&{}0&{}\dots &{}0&{}0\\ \frac{1}{6}&{}\frac{2}{3}&{}\frac{1}{6}&{}\dots &{}0&{}0\\ \vdots &{}\vdots &{}\vdots &{}\ddots &{}\vdots \\ 0&{}0&{}0&{}\dots &{}\frac{2}{3}&{}\frac{1}{6}\\ 0&{}0&{}0&{}\dots &{}\frac{1}{6}&{}\frac{2}{3}\end{array}\right) . \end{aligned}$$
(2.6)

Here, \(A_0,B_0,C_0,D_0\) are tridiagonal matrices. Set

$$\begin{aligned} {\mathfrak a}_k=2+h_0c_k,\;k=1,\dots ,N,\quad b_0=-1,\;a=\frac{2}{3},\;b=\frac{1}{6}. \end{aligned}$$
(2.7)

We have

$$\begin{aligned} A_0(i,i)= & {} {\mathfrak a}_i,\;i=1,\dots ,N,\quad A_0(i,i+1)=A_0(i+1,i)=b_0,\;i\!=\!1,\dots ,N\!-\!1, \\ B_0(i,i)\!=\! & {} 0,\;i\!=\!1,\dots ,N,\quad B_0(i,i+1)\!=\!1,\; B_0(i\!+\!1,i)=-1,\;i\!=\!1,\dots ,N\!-\!1,\nonumber \\{} & {} \quad C_0=B_0^t, \\ D_0(i,i)= & {} a,\;i=1,\dots ,N,\quad D_0(i,i+1)=D_0(i+1,i)=b,\;i=1,\dots ,N-1. \end{aligned}$$

Thus, we have reduced (2.3) to the computation of the N-dimensional vectors \({\mathfrak u}=\textrm{col}({\mathfrak u}_j)_{j=1}^N\) and \({\mathfrak u}_x=\textrm{col}(({\mathfrak u}_x)_j)_{j=1}^N\) as components of the solution of the system of linear algebraic equations

$$\begin{aligned} \left( \begin{array}{cc}A_0&{}\frac{h}{2}B_0\\ \frac{h}{2}C_0&{}h^2D_0\end{array}\right) \left( \begin{array}{c}{\mathfrak u}\\ {\mathfrak u}_x\end{array}\right) =\left( \begin{array}{c}\frac{h^4}{12}{\mathfrak f}\\ 0\end{array}\right) \end{aligned}$$
(2.8)

with the given N-dimensional vector

$$\begin{aligned} {\mathfrak f}=\textrm{col}(\phi _j)_{j=1}^N. \end{aligned}$$
(2.9)

We set \({\mathfrak y}=\frac{h^4}{12}{\mathfrak f}\).

3 The scalar quasiseparable representations

Let \(\mathcal A\) be an \(N\times N\) matrix and let l be a nonnegative entire number. We say that the sets of numbers \(p(i)\;(i=l+1,\dots ,N-l),\;q(j)\;(j=1,\dots ,N-l),\; a(k)\;(k=2,\dots ,N-l)\) form a scalar quasiseparable representation of the part \(i-j\ge l\) of \(\mathcal {A}\) if its entries are given by the equalities

$$\begin{aligned} \mathcal {A}(i,j)\!=\! \left\{ \begin{array}{ll} p(i-l+1)a(i-l)\cdots a(j+1)q(j),&{}1\le j\le i-l-1\le N-l-1,\\ p(i-1+1)q(i-l),&{}l+1\le i\le N,\;j=i-l\end{array}\right. \end{aligned}$$
(3.1)

The parameters p(i), q(j), a(k) of this representation are called scalar quasiseparable generators. The part \(i-j\ge l\) admits a scalar quasiseparable representation if and only if

$$ \textrm{rank}\mathcal {A}(k+l:N,1:k)\le 1,\quad k=1,\dots ,N-l, $$

see [7, Section 5.2].

For instance, for a tridiagonal matrix, the strictly lower triangular part \(i-j>1\) admits a scalar quasiseparable representation with generators \(p(i)=1,\;a(k)=0,\;q(j)=\mathcal {A}(j,j+1)\). The inverse of a tridiagonal matrix is a so called Green matrix (see [7, Section 6.3]). Recall that a matrix \(\mathcal {B}\) is said to be a “lower Green of order one matrix” if the relations

$$\begin{aligned} \textrm{rank}\mathcal {B}(k:N,1:k)=1,\quad k=1,\dots ,N \end{aligned}$$
(3.2)

hold. Hence, it follows that the lower triangular part \(\{i-j\ge 0\}\) of the matrix \(\mathcal {B}\) has a scalar quasiseparable representation. Such a representation is obtained in Section 5 for the matrix \(D^{-1}\). The scalar quasiseparable representation

$$ Z(i,j)=\left\{ \begin{array}{ll} p(i-1)a(i-2)\cdots a(j+1)q(j),&{}1\le j\le i-3\le N-3,\\ p(i-1)q(i-2),&{}3\le i\le N,j=i-2\end{array}\right. $$

obtained in Theorem 6.1 for the part \(\{i-j\ge 2\}\) of the matrix Z plays a crucial role in the design of the fast algorithm.

4 The class of matrices and equations

The system (2.8) belongs to a wider class of systems of linear algebraic equations. We consider systems of the form

$$\begin{aligned} \left( \begin{array}{cc}A&{}B\\ C&{}D\end{array}\right) \left( \begin{array}{c}{\mathfrak u}\\ {\mathfrak u}_x\end{array}\right) =\left( \begin{array}{c}{\mathfrak y}\\ 0\end{array}\right) \end{aligned}$$
(4.1)

with \(N\times N\) matrices ABCD and the given N-dimensional column \({\mathfrak y}\).

Assume that the matrix D and the matrix \(Z=A-BD^{-1}C\) are invertible. Using the equation \(C{\mathfrak u}+D{\mathfrak u}_x=0\) and invertibility of the matrix D, we reduce the system (4.1) to the equation

$$\begin{aligned} Z{\mathfrak u}=(A-BD^{-1}C){\mathfrak u}={\mathfrak y}. \end{aligned}$$
(4.2)

Comparing with (2.8), we have

$$ A=A_0,\;B=\frac{h}{2}B_0,\;C=C_0\frac{h}{2},\;D=h^2D_0,\; {\mathfrak y}=\frac{h^4}{12}{\mathfrak f} $$

with the matrices \(A_0,B_0,C_0,D_0\) and the vector column \({\mathfrak f}\) as in (2.4), (2.5) and (2.9). Here, \(A_0,B_0,C_0,D_0\) are tridiagonal matrices. Using the formula (4.2), we get

$$\begin{aligned} {\mathfrak u}=\left( A_0-\frac{1}{4}B_0D_0^{-1}C_0\right) ^{-1}{\mathfrak y}. \end{aligned}$$
(4.3)

We now assume that the matrices ABCD are tridiagonal and real. Moreover, the matrices A and D are symmetric, and the matrices B and C satisfy the condition \(B=C^t\); this means that the matrix Z is real and symmetric.

Furthermore, we assume that the tridiagonal matrix D and the matrix Z are strongly regular. For a matrix \(\mathcal {A}=\{a_{ij}\}_{i,j=1}^N\) (see for instance [8, Section 1]), this means that all the leading submatrices \(\mathcal {A}_k=\{a_{ij}\}_{i,j=1}^k\) are invertible. In particular, the matrix \(\mathcal {A}\) itself is invertible. A strongly regular matrix admits the factorization

$$\begin{aligned} \mathcal {A}=(I+L)\Gamma (I+L^t), \end{aligned}$$
(4.4)

where \(\Gamma =\textrm{diag}\{\gamma _1,\gamma _2,\dots ,\gamma _N\}\) is an invertible diagonal matrix with diagonal entries

$$\begin{aligned} \gamma _1=\textrm{det}\mathcal {A}_1,\quad \gamma _k=\frac{\textrm{det}\mathcal {A}_k}{\textrm{det}\mathcal {A}_{k-1}},\; k=2,\dots ,N, \end{aligned}$$
(4.5)

and L is a lower triangular matrix with zero diagonal. The strong regularity means that the values \(\gamma _k\) in (4.5) are well defined and nonzeros.

The condition that Z is strongly regular is not necessary. In our next publications, we intend to present another inversion algorithm free of this restriction. Surely this alternative algorithm is longer and more complicated than the algorithm of the present paper.

5 The inversion of a tridiagonal matrix

The first step of the procedure is the inversion of a tridiagonal real symmetric matrix. This problem was treated by many authors, see [6, 9, 12] and the literature cited therein. However, as far as we know, the quasiseparable representations of the inverses to tridiagonal matrices have never been considered in detail. We present here an algorithm for the computation of the quasiseparable representation of the inverse to a strongly regular tridiagonal matrix. The following lemma seems to be new. The advantages of using of the quasiseparable structure in the inversion of tridiagonal and, more general, band matrices were discussed in the recent paper [5] by Paola Boito and the second author.

Lemma 5.1

Let D be a strongly regular tridiagonal matrix with nonzero entries

$$ D(i,i)={\mathfrak d}_i,\;i=1,\dots ,N,\quad D(i,i+1)=D(i+1,i)=b_i,\;i=1,\dots ,N-1. $$

Then, the values \(\gamma _k,\;k=1,\dots ,N\) are determined via recursive relations

$$\begin{aligned} \gamma _1={\mathfrak d}_1,\quad \gamma _k={\mathfrak d}_k-\frac{b_{k-1}^2}{\gamma _{k-1}},\;k=2,\dots ,N. \end{aligned}$$
(5.1)

Moreover, the matrix \(D^{-1}\) is given by the formulas

$$\begin{aligned} (D^{-1})_{ij}=\left\{ \begin{array}{ll} \theta _i a(i-1)\cdots a(j),&{}1\le j< i\le N,\\ \theta _i,&{}1\le i =j\le N,\\ a(i)\cdots a(j-1)\theta _j,&{}1\le i< j\le N,\end{array} \right. \end{aligned}$$
(5.2)

where the parameters of the representation are determined via

$$\begin{aligned} f_k=\frac{b_k}{\gamma _k},\;k=1,\dots ,N-1, \end{aligned}$$
(5.3)
$$\begin{aligned} a(k)=-f_k,\;k=1,\dots ,N-1 \end{aligned}$$
(5.4)

and

$$\begin{aligned} \theta _N=1/\gamma _N,\quad \theta _k=\frac{1}{\gamma _k}+f_k^2\theta _{k+1},\; k=N-1,\dots ,1. \end{aligned}$$
(5.5)

The proof is carried out in Appendix 1.

One can check easily that the matrix \(D_0\) in (2.6) strongly regular. For instance, one can prove that in this case, \(\gamma _k\ge 1/3,\;k=1,2,\dots \). Indeed, we have \(\gamma _1=2/3>1/3\), and if \(\gamma _{k-1}\ge 1/3\) then using (5.1) with \({\mathfrak d}_k=2/3,\;b_{k-1}=1/6\), we get \(\gamma _k=2/3-\frac{1}{\gamma _{k-1}}\frac{1}{30}\ge 2/3-1/12>1/3\).

6 The matrix of the problem

The material in this section is the “heart of the matter” of this paper. We derive for the matrix of the problem a representation that fits the direct application of an algorithm presented in the paper [7]. More precisely, we show that the part \(i-j\ge 2\) of the matrix Z defined in (4.2) admits a scalar quasiseparable representation and we compute the corresponding scalar quasiseparable generators, as well as diagonal and subdiagonal entries of this symmetric matrix.

Theorem 6.1

Assume that the conditions of Lemma 5.1 hold. Applying the algorithm from this lemma to the matrix D, we determine the values \(a(k)\;(k=1,\dots ,N-1)\) and \(\theta _k\;(k=1,\dots ,N-1)\). Set \(a(0)=a(N)=\theta _0=\theta _{N+1}=0\). Assume that

$$ A(i,i)={\mathfrak a}_i,\;i=1,\dots ,N,\quad A(i,i+1)=A(i+1,i)=b_0,\;i=1,\dots ,N-1, $$

The matrix

$$\begin{aligned} Z=A-BD^{-1}C \end{aligned}$$
(6.1)

is given by the formulas

$$\begin{aligned} Z_{ij}=\left\{ \begin{array}{ll} d_i,&{}1\le j=i\le N,\\ \delta _{i-1},&{}1\le j=i-1\le N-1,\\ p(i-1)q(i-2),&{}3\le i\le N,\;j=i-2,\\ p(i-1) a(i-2)\cdots a(j+1)q(j),&{}1\le j\le i-3\le N-3,\end{array} \right. \end{aligned}$$
(6.2)

where

$$\begin{aligned} d_i={\mathfrak a}_i- \frac{1}{4}\alpha _i-\frac{1}{4}\theta _{i+1}\eta _i,\; i=1,\dots ,N, \end{aligned}$$
(6.3)
$$\begin{aligned} \delta _j=b_0 -\frac{1}{4}\theta _{j+2}a(j+1)\eta _{j}-\frac{1}{4}(\theta _{j}a(j-1)- \theta _{j+1} a(j)),\; j=1,\dots ,N-1, \end{aligned}$$
(6.4)
$$\begin{aligned} p(i-1)=-\frac{1}{2}\alpha _i,\quad i=3,\dots ,N, \end{aligned}$$
(6.5)
$$\begin{aligned} q(j)=\eta _j\frac{1}{2},\quad j=1,\dots ,N-2. \end{aligned}$$
(6.6)

with auxiliary parameters

$$\begin{aligned} \alpha _i=\theta _{i-1}-\theta _{i+1}a(i)a(i-1),\; i=1,\dots ,N, \end{aligned}$$
(6.7)
$$\begin{aligned} \eta _j=1-a(j)a(j-1),\quad j=1,\dots ,N. \end{aligned}$$
(6.8)

Proof

Consider first the matrix product \(S=BD^{-1}C\). From the definition of the matrices B and C, it follows that the rows of the matrix \(B=C^t\) and the columns of the matrix C have the form

$$\begin{aligned} \begin{gathered} B(i,:)=\left( \begin{array}{ccccc}0_{1\times (i-2)}&-1&0&1&0_{1\times (N-i-1)}\end{array}\right) ,\\ C(:,i)=\left( \begin{array}{c}0_{(i-2)\times 1}\\ -1\\ 0\\ 1\\ 0_{(N-i-1)\times 1}\end{array}\right) , \quad i=1,\dots ,N \end{gathered} \end{aligned}$$
(6.9)

with taking empty matrices for zero and negative indices. Let Q be an \(N\times N\) matrix, the matrix \(S_Q=BQC\) is obtained by the formulas

$$ S_Q(i,j)=(Q(i+1,:)-Q(i-1,:))C(:,j) $$

and next using (6.9), we get

$$\begin{aligned} S_Q(i,j)= & {} -Q(i\!-\!1,j+1)\!+\!Q(i\!-\!1,j\!-\!1)\!+\!Q(i+1,j+1)\!-\!Q(i+1,j\!-\!1),\nonumber \\{} & {} i,j=1,\dots ,N. \end{aligned}$$
(6.10)

Hence, the main diagonal of the matrix \(S_Q\) is determined via

$$\begin{aligned} S_Q(i,i)= & {} -Q(i-1,i+1)+Q(i-1,i-1)\!+\!Q(i+1,i+1)\!-\!Q(i+1,i-1),\\{} & {} i=1,\dots ,N. \end{aligned}$$

If the matrix Q is real symmetric, we have \(Q(i-1,i+1)=Q(i+1,i-1)\). Therefore,

$$\begin{aligned} S_Q(i,i)\!=\! & {} -Q(i\!-\!1,i+1)+Q(i\!-\!1,i-1)+Q(i\!+\!1,i\!+\!1)-2Q(i\!+\!1,i\!-\!1),\nonumber \\{} & {} i=1,\dots ,N. \end{aligned}$$
(6.11)

For the subdiagonal entries, i.e., for \(i=j+1\), for the real and symmetric Q, we have

$$\begin{aligned} S_Q(j+1,j)= & {} Q(j+2,j+1)-Q(j+2,j-1)-Q(j+1,j)+Q(j,j-1), \nonumber \\{} & {} j=1,\dots ,N-1. \end{aligned}$$
(6.12)

Now, we can give the details of the matrix Z. Assume that \(Q=D^{-1}\) and apply Lemma 5.1. Using (5.2), we get

$$\begin{aligned}\begin{gathered} Q(i-1,i-1)=\theta _{i-1},\;Q(i+1,i+1)=\theta _{i+1},\\ Q(i+1,i-1)=\theta _{i+1}a(i)a(i-1)=Q(i-1,i+1). \end{gathered}\end{aligned}$$

Inserting this in (6.11) and using (6.1), we get

$$ d_i={\mathfrak a}_i-\frac{1}{4}(-2\theta _{i+1}a(i)a(i-1)+ \theta _{i-1}+\theta _{i+1}),\;i=1,\dots ,N. $$

Notice that

$$ -2\theta _{i+1}a(i)a(i-1)+\theta _{i-1}+\theta _{i+1}= (\theta _{i-1}-\theta _{i+1}a(i)a(i-1))+\theta _{i+1}(1-a(i-1)a(i)) $$

and using (6.7), (6.8), we get (6.3).

Next using (5.2), we have

$$\begin{aligned} \begin{gathered} Q(j+2,j+1)=\theta _{j+2}a(j+1),\\ Q(j+2,j-1)=\theta _{j+2}a(j+1)a(j)a(j-1),\\ Q(j,j+1)=Q(j+1,j)=\theta _{j+1}a(j),\;Q(j,j-1)=\theta _{j}a(j-1). \end{gathered} \end{aligned}$$
(6.13)

Inserting (6.13) in (6.12) and using (6.1), we obtain

$$\begin{aligned} \delta _j= & {} b_0-\frac{1}{4}[(\theta _{j+2}a(j+1)(1-a(j)a(j-1))+ (\theta _{j}a(j-1)-\theta _{j+1}a(j))],\; \\{} & {} j=1,\dots ,N-1 \end{aligned}$$

and using (6.8), we get (6.4).

Finally, for \(1\le j<j+2\le i\le N\) using (5.2) again, we have

$$\begin{aligned}\begin{gathered} Q(i+1,j+1)=\theta _{i+1}a(i),\\ Q(i+1,j-1)=\theta _{i+1}a(i)\cdots a(j+1)a(j)a(j-1),\\ Q(i-1,j+1)=\theta _{i-1}a(i-2)\cdots a(j+1),\\ Q(i-1,j-1)=\theta _{i-1}a(i-1)\cdots a(j+1)a(j)a(j-1). \end{gathered}\end{aligned}$$

Inserting this in (6.10), we get

$$ S_Q(i,j)=\frac{1}{2}(\theta _{i+1}a(i)a(i-1)- \theta _{i-1})a(i-2)\cdots a(j+1)(1-a(j)a(j-1))\frac{1}{2}. $$

Using (6.1), (6.7), and (6.8), we obtain

$$\begin{aligned} Z(i,i-2)\!=\! & {} p(i-1)q(i-2),\;3\!\le \! i\!\le \! N,\!\!\quad Z(i,j)\!=\!p(i-1)a(i-2)\cdots a(j+1)\\{} & {} q(j),\;1\le j\le i-3\le N-3 \end{aligned}$$

with \(p(i-1),q(j)\) as in (6.5), (6.6) which completes the proof.\(\square \)

One can check that the condition \(c(x)\ge 0\), which implies \(c_k\ge 0\), is sufficient for the matrix Z to be strongly regular.

7 The LR factorization

We are now able to apply certain results and algorithms obtained in the paper [7]. Using Theorem 7.1 from [7], we have the following.

Theorem 7.1

Let Z be the matrix from Theorem 6.1. Assume that Z is strongly regular, meaning that it admits the factorization

$$\begin{aligned} Z=(I+L)\Gamma (I+L^t), \end{aligned}$$
(7.1)

where \(\Gamma \) is an invertible diagonal matrix and L is a lower triangular matrix with zero diagonal.

The nonzero part of the matrix L is given by the formulas

$$\begin{aligned} L_{ij}=\left\{ \begin{array}{ll} \beta _{i-1},&{}1\le j=i-1\le N-1,\\ p(i-1)g(i-2),&{}3\le i\le N, j=i-2 \\ p(i-1) a(i-2)\cdots a(j+1)g(j),&{}1\le j\le i-3\le N-3,\end{array} \right. \end{aligned}$$
(7.2)

where p(i), a(k) are the same as in Theorem 6.1 and the values \(\beta _i\;(i=2,\dots ,N-1),\;g(j)\;(j=1,\dots ,N-2)\) as well as the diagonal entries of the matrix \(\Gamma =\textrm{diag}\left( w_1,\dots ,w_N\right) \) are determined via the following algorithm.

  1. 1.

    Compute

    $$ w_1=d_1,\;\beta _1=\delta _1/w_1,\;g(1)=q(1)/w_1,\; h_1=\left( \begin{array}{c}\beta _1\\ g(1)\end{array}\right) \left( \begin{array}{cc}\delta _1&q(1)\end{array}\right) $$
  2. 2.

    For \(k=2,\dots ,N-2\) Compute the \(3\times 3\) matrix

    $$ H_k=\left( \begin{array}{cc}1&{}0\\ 0&{}p(k)\\ 0&{}a(k)\end{array}\right) h_{k-1} \left( \begin{array}{ccc}1&{}0&{}0\\ 0&{}p(k)&{}a(k)\end{array}\right) , $$
    $$ w_k=d_k-H_k(1,1), $$
    $$ e_k=\left( \begin{array}{cc}\delta _k\\ q(k)\end{array}\right) -H_k(2:3,1),\; \left( \begin{array}{c}\beta _k\\ g(k)\end{array}\right) =e_k\frac{1}{w_k}, $$
    $$ h_k=H_k(2:3,2:3)+\left( \begin{array}{c}\beta _k\\ g(k)\end{array}\right) \cdot e_k^T. $$

    Recall that here \(H_k(2:3,1)\) selects the entries 2,3 from the first column of the matrix \(H_k\) and so on.

  3. 3.

    Compute the \(2\times 2\) matrix

    $$ H_{N-1}=\left( \begin{array}{cc}1&{}0\\ 0&{}p(N-1)\end{array}\right) h_{N-2} \left( \begin{array}{ccc}1&{}0\\ 0&{}p(N-1)\end{array}\right) , $$
    $$\begin{aligned}\begin{gathered} w_{N-1}=d_{N-1}-H_{N-1}(1,1),\\ \beta _{N-1}=(\delta _{N-1}-H_{N-1}(2,1))/w_{N-1},\\ h_{N-1}=H_{N-1}(2,2)+\beta _{N-1} (\delta _{N-1}-H_{N-1}(2,1)). \end{gathered}\end{aligned}$$
  4. 4.

    Compute \(w_N=d_N-h_{N-1}\).

8 The solution of the system

Based on the LR factorization in Theorem 7.1, we obtain easily the solution of the equation \(Z{\mathfrak u}={\mathfrak y}\) as it is shown [7, Section 6, Algorithm 8.1].

Algorithm 8.1

1. Compute the solution v of the equation \((I+L)v={\mathfrak y}\).

1.1. Start with \(v(1)={\mathfrak y}(1)\) and compute \(v(2)={\mathfrak y}(2)-\beta _1 v(1)\).

1.2. Compute \(z_2=g(1)v(1),\;v(3)={\mathfrak y}(3)-\beta _2v(2)-p(2)z_2\).

1.3. For \(i=3,\dots ,N-1\) compute

$$ z_i=a(i-1)z_{i-1}+g(i-1)v(i-1),\quad v(i+1)={\mathfrak y}(i+1)-\beta _i v(i)-p(i) z_i. $$

2. Compute the solution \(\chi \) of the equation \(\Gamma \chi =v\).

$$ \chi (i)=v(i)/w_i,\quad i=1,\dots ,N. $$

3. Compute the solution \({\mathfrak u}\) of the equation \((I+L^t){\mathfrak u}=\chi \).

3.1. Start with \(u(N)=\chi (N)\) and compute \({\mathfrak u}(N-1)=\chi (N-1)-\beta _{N-1}{\mathfrak u}(N)\).

3.2. Compute \(\rho _{N-2}=p(N-1){\mathfrak u}(N),\; {\mathfrak u}(N-2)=\chi (N-2)-\beta _{N-2}{\mathfrak u}(N-1)-g(N-2)\rho _{N-2}\).

3.3. For \(i=N-3,\dots ,1\) compute

$$ \rho _i=a(i+1)\rho _{i+1}+p(i+1){\mathfrak u}(i+2),\quad {\mathfrak u}(i)=\chi (i)-\beta _i {\mathfrak u}(i+1)-g(i) \rho _i. $$

9 The complete algorithm

Combining the results of the preceding sections, we can now state the full algorithm:

Algorithm 9.1

1. Following Lemma 5.1, compute the representation of the matrix \(D^{-1}\) as follows.

Determine auxiliary variables

$$ \gamma _1=a,\quad \gamma _k=a-\frac{b^2}{\gamma _{k-1}},\;k=2,\dots ,N\quad f_k=\frac{b}{\gamma _k},\;k=1,\dots ,N-1 $$

and set

$$ a(0)=0,\quad a(k)=-f_k,\;k=1,\dots ,N-1,\quad a(N)=0. $$

Compute

$$ \theta _N=1/\gamma _N,\quad \theta _k=\frac{1}{\gamma _k}+f_k^2\theta _{k+1},\; k=N-1,\dots ,1. $$

2. Following Theorem 6.1, determine the representation of the matrix Z as follows. Compute

$$ \alpha _i=\theta _{i-1}-\theta _{i+1}a(i)a(i-1),\;\eta _i=1-a(i)a(i-1),\quad i=1,\dots ,N $$

and then compute

$$ d_i={\mathfrak a}_i- \frac{1}{4}\alpha _i-\frac{1}{4}\theta _{i+1}\eta _i,\quad i=1,\dots ,N, $$
$$ \delta _i=b_0-\frac{1}{4}\theta _{i+1}a(i)\eta _{i-1}-(\theta _{i-1}a(i-2)- \theta _i a(i-1)),,\quad i=1,\dots ,N, $$
$$ p(i-1)=-\frac{1}{2}\alpha _i,\quad i=3,\dots ,N, $$
$$ q(j)=\eta _j\frac{1}{2},\quad j=1,\dots ,N-2. $$

3. Following Theorem 7.1, compute the factorization (7.1).

3.1. Compute

$$ w_1=d_1,\;\beta _1=\delta _1/w_1,\;g(1)=q(1)/w_1,\; h_1=\left( \begin{array}{c}\beta _1\\ g(1)\end{array}\right) \left( \begin{array}{cc}\delta _1&q(1)\end{array}\right) $$

3.2. For \(k=2,\dots ,N-2\) compute

$$ H_k=\left( \begin{array}{cc}1&{}0\\ 0&{}p(k)\\ 0&{}a(k)\end{array}\right) h_{k-1} \left( \begin{array}{ccc}1&{}0&{}0\\ 0&{}p(k)&{}a(k)\end{array}\right) , $$
$$ w_k=d_k-H_k(1,1), $$
$$ e_k=\left( \begin{array}{cc}\delta _k\\ q(k)\end{array}\right) -H_k(2:3,1),\; \left( \begin{array}{c}\beta _k\\ g(k)\end{array}\right) =e_k\frac{1}{w_k}, $$
$$ h_k=H_k(2:3,2:3)+\left( \begin{array}{c}\beta _k\\ g(k)\end{array}\right) \cdot e_k^T. $$

3.3. Compute

$$ H_{N-1}=\left( \begin{array}{cc}1&{}0\\ 0&{}p(N-1)\end{array}\right) h_{N-2} \left( \begin{array}{ccc}1&{}0\\ 0&{}p(N-1)\end{array}\right) , $$
$$\begin{aligned}\begin{gathered} w_{N-1}=d_{N-1}-H_{N-1}(1,1),\\ \beta _{N-1}=(\delta _{N-1}-H_{N-1}(2,1))/w_{N-1},\\ h_{N-1}=H_{N-1}(2,2)+\beta _{N-1} (\delta _{N-1}-H_{N-1}(2,1)). \end{gathered}\end{aligned}$$

3.4. Compute \(w_N=d_N-h_{N-1}\).

4. Following Algorithm 8.1, compute the solution of the system \(Z {\mathfrak u}={\mathfrak y}\).

4.0. Compute \({\mathfrak y}(i)=\frac{h^4}{12}\phi _i,\;i=1,\quad ,N\).

4.1.1. Start with \(v(1)={\mathfrak y}(1)\) and compute \(v(2)={\mathfrak y}(2)-\beta _1 v(1)\).

4.1.2. Compute \(z_2=g(1)v(1),\;v(3)={\mathfrak y}(3)-\beta _2v(2)-p(2)z_2\).

4.1.3. For \(i=3,\dots ,N-1\) compute

$$ z_i=a(i-1)z_{i-1}+g(i-1)v(i-1),\quad v(i+1)={\mathfrak y}(i+1)-\beta _i v(i)-p(i) z_i. $$

4.2. Compute the solution \(\chi \) of the equation \(\Gamma \chi =v\).

$$ \chi (i)=v(i)/w_i,\quad i=1,\dots ,N. $$

4.3.1. Start with \({\mathfrak u}(N)=\chi (N)\) and compute \({\mathfrak u}(N-1)=\chi (N-1)-\beta _{N-1}{\mathfrak u}(N)\).

4.3.2. Compute \(\rho _{N-2}=p(N-1){\mathfrak u}(N),\; {\mathfrak u}(N-2)=\chi (N-2)-\beta _{N-2}{\mathfrak u}(N-1)-g(N-2)\rho _{N-2}\).

4.3.3. For \(i=N-3,\dots ,1\) compute

$$ \rho _i=a(i+1)\rho _{i+1}+p(i+1){\mathfrak u}(i+2),\quad {\mathfrak u}(i)=\chi (i)-\beta _i u(i+1)-g(i) \rho _i. $$

Here, \(z_i,\rho _i\) are auxiliary variables.

All this algorithm requires O(N), i.e., linear in N, number of arithmetic operations, in contrast to \(O(N^2)\) in a general case and also with \(O(N\log N)\) in the based on FFT algorithm in the case of constant potential.

Numerical evidence is given below in Section 11.4.

10 A fast algorithm for the zero potential

For the case of zero potential \(c(x)=0\) in [4] using the kernel method, an explicit solution of (4.3) was obtained via

$$\begin{aligned} {\mathfrak u}_j=h\sum _{j=1}^N K(x_i,x_j)\phi _j,\quad j=1,\dots ,N \end{aligned}$$
(10.1)

with

$$\begin{aligned} K(x,y)=\left\{ \begin{array}{ll} \frac{1}{6}(1-x)^2y^2[2x(1-y)+x-y],&{}y\le x,\\ \frac{1}{6}(1-y)^2x^2[2y(1-x)+y-x],&{}x\le y.\end{array} \right. \end{aligned}$$
(10.2)

Notice that the expression in the brackets may be done as

$$ 2x(1-y)+x-y=\left( \begin{array}{cc}x&-1\end{array}\right) \left( \begin{array}{c}3-2y\\ y\end{array}\right) . $$

Setting

$$ \varphi (x)=\frac{1}{6}(1-x)^2\left( \begin{array}{cc}x&-1\end{array}\right) ,\quad \psi (x)=\left( \begin{array}{cc}3-2x&x\end{array}\right) x^2, $$

we get

$$\begin{aligned} K(x,y)=\left\{ \begin{array}{ll} \varphi (x)\psi ^t(y),&{}y\le x,\\ \psi (x)\varphi ^t(y),&{}x\le y.\end{array} \right. \end{aligned}$$
(10.3)

Thus, using (10.1), we get

$$\mathfrak u_i=h\sum _{i=1}^N K(x_i,x_j)\phi _j= h\sum _{j=1}^i\varphi (x_i)\psi ^t(x_j)\phi _j+ h\sum _{j=i+1}^N\psi (x_i)\varphi ^t(x_j)\phi _j $$

which implies

$$\begin{aligned} \mathfrak u_i =h(\varphi (x_i)\chi _i+\psi (x_i)z_i),\quad i=1,\dots ,N \end{aligned}$$
(10.4)

with

$$ \chi _i=\sum _{j=1}^i\psi ^t(x_j)\phi _j,\;i=1,\dots ,N,\quad z_i=\sum _{j=i+1}^N\varphi ^t(x_j)\phi _j,\;i=N-1,\dots ,1. $$

Here, the sums are obtained recursively via relations

$$\begin{aligned} \chi _0= & {} 0,\;\chi _i=\chi _{i-1}+\psi ^t(x_i)\phi _i,\;i=1,\dots ,N,\quad z_N=0,\;z_i=z_{i+1}+\varphi ^t(x_i)\phi _i,\;\nonumber \\ i= & {} N-1,\dots ,1. \end{aligned}$$
(10.5)

Combining (10.4) and (10.5) together, we obtain the following procedure of linear O(N) complexity.

Algorithm 10.1

Set \(\chi _0=0_{2\times 1}\) and for \(i=1,\dots ,N\) compute \(\chi _i=\chi _{i-1}+\psi ^t(x_i)\phi _i\).

Set \(z_N=0_{2\times 1}\) and for \(i=N-1,\dots ,1\) compute \(z_i=z_{i+1}+\varphi ^t(x_i)\phi _i\).

For \(i=1,\dots ,N\) compute \(u_i=h(\varphi (x_i)\chi _i+\psi (x_i)z_i)\).

11 Numerical results

In the numerical results section, we consider problems of the form

$$\begin{aligned} \begin{array}{ll} u^{(4)}+c(x) u =\phi ,\quad 0<x<1,\\ u(0)=u'(0)=u(1)=u'(1)=0. \end{array} \end{aligned}$$
(11.6)

We measure the error \(e(x_i)= u_{comp})_i-u_{exact}(x_i)\) using the norms \(\vert e\vert _2\) and \(\vert e\vert _{\infty }\) where

$$\begin{aligned} \begin{array}{ll} \vert e\vert _2=\sqrt{\sum _{i=1}^N h |(u_{comp})_i-u_{exact}(x_i)|^2},\\ \\ \vert e\vert _{\infty }=\max _{1\le i\le N} |(u_{comp})_i-u_{exact}(x_i)|, \end{array} \end{aligned}$$
(11.7)

The rate of convergence is defined as follows. Assume that the discrete \(l_2\) norm \(\vert e\vert _2\) on a coarse mesh \(h_1\) is \(\vert e\vert _{2,h_1}\) and that the discrete \(l_2\) norm \(\vert e\vert _2\) on a finer mesh \(h_2=0.5 h_1\) is \(\vert e\vert _{2,h_2}\), then the rate of convergence is defined as

$$\begin{aligned} \begin{array}{ll} Rate=\log _2(\vert e\vert _{2,h_1} / \vert e\vert _{2, h_2}). \end{array} \end{aligned}$$
(11.8)

Similarly for the rate of convergence for the discrete infinity norm.

11.1 Example 1

Here, we consider the problem (11.6) with \(c(x)=1\).

$$\begin{aligned} \begin{array}{ll} u^{(4)}+u=\phi (x),\quad 0<x<1,\\ u(0)=u'(0)=u(1)=u'(1)=0. \end{array} \end{aligned}$$
(11.9)

The exact solution is \(u(x)=\sin ^2(\pi x)\); therefore, the right-hand side \(\phi (x)\) of the differential equation is \(\phi (x)=-8\pi ^4 \cos (2 \pi x)+x~sin^2(\pi x)\). The numerical errors are shown in Table 1.

Table 1 Example 1: The equation is \(u^{(4)}+u=-8\pi ^4 \cos (2 \pi x)+sin^2(\pi x)\), with the exact solution \(u(x)=\sin ^2(\pi x)\), where \(\vert e\vert _h\) is the discrete \(l_2\) norm and \(\vert e\vert _{\infty }\) is the error in \(l_{\infty }\)
Table 2 Example 2: The equation is \(u^{(4)}+x~u=-8\pi ^4 \cos (2 \pi x)+x~\sin ^2(\pi x)\), with the exact solution \(u(x)=\sin ^2(\pi x)\), where \(\vert e\vert _h\) is the discrete \(l_2\) norm and \(\vert e\vert _{\infty }\) is the error in \(l_{\infty }\)

11.2 Example 2

Here, we consider the problem (11.6) with \(c(x)=x\)

$$\begin{aligned} \begin{array}{ll} u^{(4)}+x u=\phi (x),\quad 0<x<1,\\ u(0)=u'(0)=u(1)=u'(1)=0. \end{array} \end{aligned}$$
(11.10)

The exact solution is \(u(x)=\sin ^2(\pi x)\); therefore, the right-hand side \(\phi (x)\) of the differential equation is \(\phi (x)=-8\pi ^4 cos(2 \pi x)+sin^2(\pi x)\). The numerical errors are shown in Table 2.

In Fig. 1, we display the plots of the numerical solution (left) and the error (right).

11.3 Example 3

Here, we consider the problem (11.6) with \(c(x)=1/((x-0.5)^2+\epsilon )\).

$$\begin{aligned} \begin{array}{ll} u^{(4)}+c(x) u=\phi (x),\quad 0<x<1,\\ u(0)=u'(0)=u(1)=u'(1)=0. \end{array} \end{aligned}$$
(11.11)

The numerical errors are shown in Table 3.

Fig. 1
figure 1

Example 2: The equation is \(u^{(4)}+x~u=\phi (x)\), with the exact solution \(u(x)=sin^2(\pi x)\): Left: Exact solution (solid line) and computed solution (circles) for \(N=127\) and Right: The error \(u_{comp}-u_{exact}\) for \(N=127\)

Table 3 Example 3: The equation is \(u^{(4)}+c(x) u=\phi (x)\), with the exact solution \(u=p(x) \sin (1/q(x))\), where \(p(x)=16x^2(1-x)^2\), with \(\epsilon =0.05\), \(c(x)=1/q(x)\)
Fig. 2
figure 2

Example 3: The equation is \(u^{(4)}+c(x)~u=\phi (x)\), with exact solution \(u(x)=p(x) \sin (1/q(x))\), where \(p(x)=16x^2(1-x)^2\), \(q(x)=(x-0.5)^2+\epsilon \), with \(\epsilon =0.05\) and \(c(x)=1/q(x)\): Left: Exact solution (solid line) and computed solution (circles) for \(N=255\) and Right: The error \(u_{comp}-u_{exact}\) for \(N=255\)

We pick an exact solution u of the form \(u=p(x) \sin (1/q(x))\), where \(p(x)=16x^2(1-x)^2\), \(q(x)=(x-0.5)^2+\epsilon \), with \(\epsilon =0.05\). In addition, \(c(x)=1/q(x)\). The right-hand side \(\phi (x)\) of the equation is \(\phi (x)=u^{(4)}(x)+ c(x) u(x)\).

In Fig. 2, we display the plots of the numerical solution (left) and the error (right).

11.4 Numerical evidence on the complexity of the algorithm

In Table 4, we display computational times in seconds as N grows for Example 3.

All this algorithm requires O(N), i.e., linear in N, number of arithmetic operations, in contrast to \(O(N^2)\) in a general case and also with \(O(N\log N)\) in the based on FFT algorithm in the case of constant potential.

Table 4 Complexity of the Algorithm

12 Summary

We have performed several numerical tests which assure the fourth order convergence of the scheme for the biharmonic equation also in case of the presence of a variable potential c(x). In the example \(c(x)=1\) (a positive constant), in the second example \(c(x)=x\) (a non negative function on the interval (0, 1)), and in the third example \(c(x)=x\) but for the case of highly oscillatory solution. In Table 4, we have displayed the computational time for the whole numerical procedure in cases where \(N=2047, 4096, 8191, 15381\) (N is doubled throughout the test), and we obtain the running time is growing as O(N), as expected from the design of the scheme.