14
European Society of Computational Methods in Sciences and Engineering (ESCMSE) Journal of Numerical Analysis, Industrial and Applied Mathematics (JNAIAM) vol. 6, no. 1-2, 2011, pp. 1-13 ISSN 1790–8140 A Matrix Method for the Solution of Sturm-Liouville Problems 1 Pierluigi Amodio 2 , Giuseppina Settanni 3 Dipartimento di Matematica, Universit` a di Bari, I-70125 Bari, Italy Received 22 February, 2011; accepted in revised form 13 March, 2011 Abstract: We investigate the numerical solution of regular and singular Sturm-Liouville problems by means of finite difference schemes of high order. In particular, a set of differ- ence schemes is used to approximate each derivative independently so to obtain an algebraic problem corresponding to the original continuous differential equation. The endpoints are treated depending on their classification and in case of limit points, no boundary condi- tion is required. Several numerical tests are finally reported on equispaced grids show the convergence properties of the proposed approach. c 2011 European Society of Computational Methods in Sciences and Engineering Keywords: Sturm-Liouville problems, finite difference schemes, matrix method. Mathematics Subject Classification: 65L15, 65L10, 65L12, 65Z05 PACS: 02.60.Lj, 02.70.Bf 1 Introduction We study the general Sturm-Liouville equation (p(x)y ) + q(x)y = λr(x)y, x I R, y,λ R. (1) Here I can be a compact interval [a, b] or a open, bounded or unbounded, interval (a, b) (i.e., −∞ ≤ a<b ≤∞). We assume that the set of Sturm-Liouville coefficients p, q, r : I R satisfy p 1 ,q,r L loc (I ), p> 0 and r> 0 in (a, b). The equation (1) is subjected to separated boundary conditions a 1 [y,u](a)+ a 2 [y,v](a)=0, (a 1 ,a 2 ) ̸= (0, 0), b 1 [y,u](b)+ b 2 [y,v](b)=0, (b 1 ,b 2 ) ̸= (0, 0), (2) where the Wronskian [f,g] is defined for two admissible functions as [f,g](x)= f (x)(pg )(x) (pf )(x)g(x), and u and v are two linearly independent solutions of the Sturm-Liouville equation for some arbitrary λ,[u, v](a) ̸= 0 and [u, v](b) ̸= 0. 1 Published electronically May 15, 2011 2 Corresponding author. E-mail: [email protected] 3 E-mail: [email protected]

A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

  • Upload
    vuquynh

  • View
    222

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

European Society of Computational Methodsin Sciences and Engineering (ESCMSE)

Journal of Numerical Analysis,Industrial and Applied Mathematics

(JNAIAM)vol. 6, no. 1-2, 2011, pp. 1-13

ISSN 1790–8140

A Matrix Method for the Solutionof Sturm-Liouville Problems 1

Pierluigi Amodio2, Giuseppina Settanni3

Dipartimento di Matematica,Universita di Bari,I-70125 Bari, Italy

Received 22 February, 2011; accepted in revised form 13 March, 2011

Abstract: We investigate the numerical solution of regular and singular Sturm-Liouvilleproblems by means of finite difference schemes of high order. In particular, a set of differ-ence schemes is used to approximate each derivative independently so to obtain an algebraicproblem corresponding to the original continuous differential equation. The endpoints aretreated depending on their classification and in case of limit points, no boundary condi-tion is required. Several numerical tests are finally reported on equispaced grids show theconvergence properties of the proposed approach.

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering

Keywords: Sturm-Liouville problems, finite difference schemes, matrix method.

Mathematics Subject Classification: 65L15, 65L10, 65L12, 65Z05

PACS: 02.60.Lj, 02.70.Bf

1 Introduction

We study the general Sturm-Liouville equation

−(p(x)y′)′ + q(x)y = λr(x)y, x ∈ I ⊆ R, y, λ ∈ R. (1)

Here I can be a compact interval [a, b] or a open, bounded or unbounded, interval (a, b) (i.e.,−∞ ≤ a < b ≤ ∞). We assume that the set of Sturm-Liouville coefficients p, q, r : I → R satisfyp−1, q, r ∈ Lloc(I), p > 0 and r > 0 in (a, b). The equation (1) is subjected to separated boundaryconditions

a1[y, u](a) + a2[y, v](a) = 0, (a1, a2) = (0, 0),b1[y, u](b) + b2[y, v](b) = 0, (b1, b2) = (0, 0),

(2)

where the Wronskian [f, g] is defined for two admissible functions as [f, g](x) = f(x)(pg′)(x) −(pf ′)(x)g(x), and u and v are two linearly independent solutions of the Sturm-Liouville equationfor some arbitrary λ, [u, v](a) = 0 and [u, v](b) = 0.

1Published electronically May 15, 20112Corresponding author. E-mail: [email protected]: [email protected]

Page 2: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

2 P. Amodio, G. Settanni

The unspecified parameter λ, called eigenvalue, exists for non-trivial solution of (1)-(2), whereasthe solution is called eigenfunction associated with λ. We consider a Sturm-Liouville problem withan infinite but countable number of eigenvalues, which are real and bounded below, so that theycan be ordered as

−∞ < λ0 < λ1 < λ2 < λ3 < . . . with limn→∞

λn = ∞. (3)

In addition, the associated eigenfunctions Yn(x) are orthogonal to each other with respect to theweight function r(x),∫ b

a

r(x)Ym(x)Yn(x)dx = 0 if m = n, and m,n = 1, 2, . . . .

As for the usual algebraic eigenvalue problem, the eigenfunctions are uniquely computed accordingto a specified normalization function.

The Sturm-Liouville boundary value problems are important in applied mathematics and inmathematical physics where they are involved in the description of many phenomena. Typical ex-amples of Sturm-Liouville problems are Bessel equation, Legendre equation, Laguerre equation andHermite equation, whose eigenfunctions are the homonym functions or polynomials, respectively.

We distinguish between a regular problem and a singular one through the classification of theendpoints. Speaking about the left endpoint a (for the right endpoint b the treatment is similar),we say that it is regular if p−1, q, r ∈ L([a, c]) for c ∈ (a, b). If both the endpoints of the intervalare regular, then the separated boundary conditions (2) become

a1y(a) + a2(py′)(a) = 0, (a1, a2) = (0, 0),

b1y(b) + b2(py′)(b) = 0, (b1, b2) = (0, 0).

(4)

Vice versa an endpoint is singular if it is not regular, and this means that either it is infiniteor it is finite, but at least one of p−1, q or r is not integrable in any neighborhood of the endpoint.If the singular endpoint a is classified as limit circle (LC), it means that the solution of (1) is inL2r(a, c) for c ∈ (a, b), and then a left boundary condition (2) is required. It is possible that a LC

endpoint is oscillatory (LCO), namely the nontrivial solution of (1) has an infinite number of zerosin any neighborhood of it. In this paper we do not treat LCO endpoints, but LC non oscillatory(LCNO) endpoints satisfying the property (3). Moreover, a singular endpoint is a limit point (LP)if it is not LC, and then no boundary condition is needed.

The aim is to analyze the numerical solution of various (regular and singular) Sturm-Liouvilleproblems by means of finite difference schemes [2, 3]. In this context, the idea is to transform thecontinuous problem (1) in a discrete one approximating each derivative by means of an appropriatedifference scheme. This kind of approach, typical of several methods for PDEs approximation, hasbeen proposed in the last few years for the solution of general second order evolutionary problems

f(x, y, y′, y′′) = 0 (5)

subject to initial or boundary conditions (see [8, 9, 4, 5, 6]). Since the methods considered empha-size a nice behavior when applied to both second order initial and boundary value problems, firstlywe have applied them to eigenvalue IVPs (see [7]), showing that the obtained methods maintain theorder of accuracy of the underlined schemes for regular problems, while often the order of accuracydecays for singular problems. The main advantage with respect to the classical Runge-Kutta andlinear multistep methods is that this approach does not require the reformulation of equation (5) asan equivalent first order one with y and y′ as unknowns. This is useful to lower the computationalcost (the size of the continuous problem is halved) and to simplify step variation because y and

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering (ESCMSE)

Page 3: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

Numerical Solution of Sturm-Liouville Problems 3

y′ have in general a different behavior. Another positive feature of this approach is that not onlyeach derivative is obviously discretized with a different scheme, but also each derivative may bediscretized at each grid point with a different scheme depending on the position of the point itself.This aspect, typical of BVMs (see, for example, the main reference [10]) where a main method isused in the central points of the grid and is associated to initial and final methods used once inthe other points, allows to reach high orders of accuracy easily.

The paper is organized as follows: in the next section high order finite difference schemes arebriefly described. In the successive section we explain how to derive a matrix method to computethe eigenvalues and the eigenfunction of the Sturm-Liouville problem. Finally, the last section isdevoted to several examples to emphasize the behavior of the method on classical examples.

2 High order finite difference schemes

In this section we describe high order finite difference schemes for the approximation of generalsecond order differential equations. These schemes will be used in the next section to solve Sturm-Liouville problems. For simplicity, we first suppose problem (5) is solved for x ∈ [a, b] withboundary conditions y(a) = ya and y(b) = yb. Then, we discretize [a, b] by means of n + 1equispaced points xi = a+ ih, i = 0, . . . , n, where h = (b− a)/n.

Finite differences are linear multistep schemes approximating the derivatives of (5) in thepoints xi, i = 1, . . . , n − 1. For a fixed number k of points, it is possible to define k alternativeschemes approximating y(ν)(xi) and depending on the considered stencil xi−s+1, . . . , xi−s+k (herewe suppose 0 < s ≤ k)

y(ν)(xi) ≈ y(ν)i =

1

k∑j=1

α(ν)j,s yi−s+j , ν = 1, 2, (6)

where the coefficients α(ν)j,s in (6) are always chosen in order the above formula have maximum

order. The order of each formula is k − ν with the exception of the formulae for ν = 2, k oddand s = (k + 1)/2 which have order k − 1. The idea carried on in [8] and the subsequent papersis to select a combination of schemes of the same order with the best stability properties. In thefollowing we will use schemes of even order p, that is k = p+ 1 odd for the first derivative while,for the second derivative, k = p+1 odd for the scheme with symmetric stencil and k = p+2 evenfor the others.

For the second derivative just the schemes with symmetric stencil have the best stability prop-erties. For the first derivative, in [9, 4, 5, 6] it is suggested to use schemes with s = (k − 1)/2 ors = (k+3)/2 depending on the sign of the coefficient multiplying the derivative. For Sturm-Liouvilleproblems, symmetry reasons suggest to use schemes with symmetric stencil (s = (k + 1)/2). Theformula selected to approximate each derivative is called main scheme.

For p ≥ 4 the main scheme cannot be used on all the points of the grid: for example, forthe order 4, main schemes approximating the derivatives in x1 and xn−1 would require the valuesin x−1 and xn+1. Consequently is necessary to use different formulae (called initial and finalschemes) to approximate derivatives in the initial and final points of the mesh. So, in general,the approximation of a derivative in all the internal points of the grid requires a combination offormulae, some of them used once in the initial and final gridpoints. As an example, for the order

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering (ESCMSE)

Page 4: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

4 P. Amodio, G. Settanni

4 we use the schemes

y′(xi) ≈ y′i =1

h

(−1

4y0 −

5

6y1 +

3

2y2 −

1

2y3 +

1

12y4

), i = 1(

1

12yi−2 −

2

3yi−1 +

2

3yi+1 −

1

12yi+2

), i = 2, . . . , n− 2,(

− 1

12yn−4 +

1

2yn−3 −

3

2yn−2 +

5

6yn−1 +

1

4yn

), i = n− 1

which in matrix form is represented asY ′ = A1Y , (7)

where Y ′ =(y′1, . . . , y

′n−1

)T, Y = (y0, . . . , yn)

T=

(y0, Y

T , yn)T

and

A1 =1

h

− 14 −5

632 −1

2112

112 −2

3 0 23 − 1

12. . .

. . .. . .

. . .. . .

. . .. . .

. . .. . .

. . .112 −2

3 0 23 − 1

12

− 112

12 − 3

256

14

(n−1)×(n+1)

. (8)

Analogously,

y′′(xi) ≈ y′′i =1

h2

(5

6y0 −

5

4y1 −

1

3y2 +

7

6y3 −

1

2y4 +

1

12y5

), i = 1(

− 1

12yi−2 +

4

3yi−1 −

5

2yi +

4

3yi+1 −

1

12yi+2

), i = 2, . . . , n− 2,(

1

12yn−5 −

1

2yn−4 +

7

6yn−3 −

1

3yn−2 −

5

4yn−1 +

5

6yn

), i = n− 1

orY ′′ = A2Y , (9)

where Y ′′ =(y′′1 , . . . , y

′′n−1

)Tand

A2 =1

h2

56 −5

4 − 13

76 − 1

2112

− 112

43 − 5

243 − 1

12. . .

. . .. . .

. . .. . .

. . .. . .

. . .. . .

. . .

− 112

43 −5

243 − 1

12

112 −1

276 −1

3 −54

56

(n−1)×(n+1)

. (10)

Hence, the differential equation (5) is substituted by a nonlinear system of equations

f(X,Y, Y ′, Y ′′) = 0 (11)

in the unknown vector Y .Sometimes boundary conditions also involve first derivatives in the extreme points. So, for

example, we haveγ0y(a) + δ0y

′(a) = ya, γ1y(b) + δ1y′(b) = yb. (12)

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering (ESCMSE)

Page 5: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

Numerical Solution of Sturm-Liouville Problems 5

The values y′(a) and y′(b) were not considered in the previous formulae. So the simplest thing todo is to approximate them by means of (6) with s = 1 and s = k, respectively; in such a caseboundary conditions (12) are approximatively satisfied. In this case it is however preferable totreat y′(a) and y′(b) as additional unknowns. We use the following initial and final schemes inplace of the previous ones:

y′(xi) ≈ y′i =1

h

hy′0, i = 0(−h

3y′0 −

17

18y0 +

1

2y1 +

1

2y2 −

1

18y3

), i = 1(

1

18yn−3 −

1

2yn−2 −

1

2yn−1 +

17

18yn − h

3y′n

), i = n− 1

hy′n, i = n

and

y′′(xi) ≈ y′′i =1

h2

(−25h

6y′0 −

415

72y0 + 8y1 − 3y2 +

8

9y3 −

1

8y4

), i = 0(

5h

12y′0 +

257

144y0 −

10

3y1 +

7

4y2 −

2

9y3 +

1

48y4

), i = 1(

1

48yn−4 −

2

9yn−3 +

7

4yn−2 −

10

3yn−1 +

257

144yn − 5h

12y′n

), i = n− 1(

−1

8yn−4 +

8

9yn−3 − 3yn−2 + 8yn−1 −

415

72yn +

25h

6y′n

), i = n

Now the approximation (7) and (9) are defined for Y ′ = (y′0, . . . , y′n)

T, Y = (y′0, y0, . . . , yn, y

′n)

T=(

y′0, YT , y′n

)Tand

A1 =1

h

h−h

3 − 1718

12

12 − 1

18

112 −2

3 0 23 − 1

12. . .

. . .. . .

. . .. . .

. . .. . .

. . .. . .

. . .112 − 2

3 0 23 − 1

12

118 −1

2 − 12

1718 −h

3

h

(n+1)×(n+3)

, (13)

A2 =1

h2

−25h6 −415

72 8 −3 89

18

5h12

257144 − 10

374 − 2

9148

− 112

43 −5

243 − 1

12. . .

. . .. . .

. . .. . .

. . .. . .

. . .. . .

. . .

− 112

43 − 5

243 − 1

12

148 −2

974 −10

3257144 −5h

12

− 18

89 −3 8 − 415

7225h6

(n+1)×(n+3)

. (14)

Obviously the absence of one of the first derivative term in the boundary conditions allows us tosimplify initial and final schemes as said previously.

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering (ESCMSE)

Page 6: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

6 P. Amodio, G. Settanni

3 Algebraic solution of Sturm-Liouville problems

In this section we apply high order finite difference schemes to Sturm-Liouville equations (1). Themain difference with respect to the equation (5) is the presence of the unknown parameter λ inthe equation as well as possible singularities in the extreme points.

Supposing, for simplicity, that the problem is regular on a finite interval and (4) containsa2 = b2 = 0. Then (1) is equivalent to

−p(x)y′′ − p′(x)y′ + q(x)y = λr(x)y, x ∈ [a, b], y, λ ∈ R (15)

and it is approximated byR−1 (−PA2 − P1A1 +Q)Y = λY (16)

where R, P , P1 and Q are diagonal matrices of size n− 1 containing r(xi), p(xi), p′(xi) and q(xi),

i = 1, . . . , n− 1, respectively, A1 and A2 are square matrices extracted by (8) and (10) neglecting

the first and the last column (which are multiplied by y0 = yn = 0), and Y = (y1, . . . , yn−1)T.

Eigenvalues and eigenfunctions of (15) are eigenvalues and eigenvectors of the sparse matrixM = R−1 (−PA2 − P1A1 +Q) in (16). Hence they will be computed in the next section by meansof a linear algebra tool. Anyway, we stress that the same result could be reached by solving thenonlinear system (16) in the unknowns λ and Y by using a normalization condition on the vectorY as additional equation and a suitable initial guess for the eigenvalue required.

For general boundary conditions (4), where a1, a2, b1 and b2 are all different from 0, the idea isalways to reduce the size of the problem and use an algebraic tool. In this case the approximationof (15) is given by

R−1(−P A2 − P1A1 + QI

)Y = λY, (17)

where A1 and A2 are the rectangular matrices (13) and (14), Y = (y′0, Y, y′n)

T, Y = (y0, y1, . . . , yn)

T,

I = [o In+1 o] and R, P , P1 and Q are diagonal matrices of size n + 1 containing r(xi), p(xi),p′(xi) and q(xi), i = 0, . . . , n. As a consequence of (4), we consider a matrix of transformation

D =

a2p(a) a1

1. . .

1b1 b2p(b)

(n+3)×(n+3)

.

such that DY = (a1y0 + a2p(a)y′0, y0, . . . , yn, b1yn + b2p(b)y

′n)

Tcontains the first and the last

element which are zero. Then (17) is equivalent to

R−1(−P A2 − P1A1 + QI

)D−1DY = R−1

(−PA2 − P1A1 + Q

)Y = λY,

where again a square matrix is extracted by the original rectangular one erasing the first and thelast column; as in the previous case we obtain an algebraic eigenvalue problem whose eigenvaluesand eigenvectors are the eigenvalues and eigenfunctions of the original problem (15).

In case of singular Sturm-Liouville problems with (for simplicity both) LP endpoints, no bound-ary condition is required and hence it is necessary to add two finite difference schemes to (7) and(9). To this aim we consider initial and final methods approximating equation (15) in both theendpoints (here we again use order 4):

y′(x0) ≈ y′0 =1

h

(−25

12y0 + 4y1 − 3y2 +

4

3y3 −

1

4y4

),

y′(xn) ≈ y′n =1

h

(1

4yn−4 −

4

3yn−3 + 3yn−2 − 4yn−1 +

25

12yn

),

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering (ESCMSE)

Page 7: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

Numerical Solution of Sturm-Liouville Problems 7

y′′(x0) ≈ y′′0 =1

h2

(15

4y0 −

77

6y1 +

107

6y2 − 13y3 +

61

12y4 −

5

6y5

),

y′′(xn) ≈ y′′n =1

h2

(−5

6yn−5 +

61

12yn−4 − 13yn−3 +

107

6yn−2 −

77

6yn−1 +

15

4yn

),

Matrices (8) and (10) becomes

A1 =1

h

−2512 4 −3 4

3 − 14

−14 −5

632 −1

2112

112 −2

3 0 23 − 1

12. . .

. . .. . .

. . .. . .

. . .. . .

. . .. . .

. . .112 − 2

3 0 23 − 1

12

− 112

12 −3

256

14

14 − 4

3 3 −4 2512

(n+1)×(n+1)

, (18)

and

A2 =1

h2

154 −77

61076 −13 61

12 −56

56 − 5

4 −13

76 −1

2112

− 112

43 −5

243 − 1

12. . .

. . .. . .

. . .. . .

. . .. . .

. . .. . .

. . .

− 112

43 −5

243 − 1

12

112 − 1

276 −1

3 − 54

56

−56

6112 −13 107

6 −776

154

(n+1)×(n+1)

. (19)

Consequently, equation (15) is approximated by

R−1(−PA2 − P1A1 + Q

)Y = λY,

where Y = (y0, . . . , yn)Tand P , P1 Q are the same matrices used in (17).

We observe that it could happen that the coefficients of Sturm-Liouville problems are notdefined in the endpoints, so we have to consider a truncated interval [α, β] with a < α < β < b.

4 Numerical examples

In this section we examine some examples of Sturm-Liouville problems with one or both theendpoints regular, LCNO or LP. Except for unbounded problems, we have always consideredconstant step size in order to estimate the numerical order of convergence. Unbounded intervalsare transformed into limited ones before a constant stepsize is applied. Methods of order 4, 6 and8 are considered and, as explained in Section 3, the matlab tool for sparse matrices eigs is used toevaluate both the eigenvalues and the eigenvectors.

At the beginning, we test the methods on a regular problem (Problem 1) and on a regularone that looks singular (Problem 2). Afterwards, we solve the same Sturm-Liouville problem (thehydrogen equation) on a truncated interval (Problem 3) and on an upper unbounded one (Problem

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering (ESCMSE)

Page 8: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

8 P. Amodio, G. Settanni

Table 1: Numerical results for Test problem 1.

p = 4 p = 6 p = 8

Mesh Error Order Error Order Error Order

200 1.01e-05 3.45 4.26e-07 6.16 1.61e-07 8.65λ0 400 9.19e-07 3.89 5.97e-09 6.91 4.01e-10 9.08

600 1.90e-07 3.96 3.63e-10 7.35 1.01e-11 1.45800 6.08e-08 - 4.38e-11 - 1.55e-13 -300 2.88e-04 7.13 9.14e-05 12.22 2.64e-05 8.05600 2.05e-06 1.92 1.92e-08 2.34 9.95e-08 9.96

λ4 900 9.42e-07 2.38 7.42e-09 7.57 1.75e-09 10.811.200 4.75e-07 3.24 8.39e-10 11.22 7.82e-11 12.971.500 2.31e-07 - 6.86e-11 - 4.33e-12 -2000 5.69e-05 3.19 5.53e-06 6.85 3.33e-07 7.272500 2.79e-05 3.53 1.20e-06 6.92 6.58e-08 8.84

λ24 3000 1.47e-05 3.70 3.40e-07 6.85 1.31e-08 9.513500 8.30e-06 3.79 1.18e-07 6.74 3.03e-09 9.934000 5.00e-06 - 4.81e-08 - 8.05e-10 -

4). Here the left endpoint is LP while the right one is regular in the first case and LP in the second.We point out again that no boundary condition is required in a LP endpoint, and this is substitutedby an initial or a final method. Finally, in the last example the endpoints are both LCNO andboundary conditions are needed.

Problem 1. The Klotter problem (see [14]) is defined as

−y′′(x) +3

4x2y(x) = λ

64π2

9x6y(x), x ∈ [8/7, 8],

a = 8/7 regular,

b = 8 regular,

with boundary conditions y(8/7) = y(8) = 0. The eigenvalues are

λk = (k + 1)2, k = 0, 1, . . .

As shown in Table 1, the numerical order is preserved for each eigenvalue. Greater eigenvaluesrequire more points than the smaller ones in order to obtain a good approximation. Anyway, it isclearly visible that a better accuracy is gained with the higher order methods.

Problem 2. The regular problem (see [14])

−(

1√1− x2

y′)′

(x) = λ1√

1− x2y(x), x ∈ [−1, 1],

a = −1 regular,b = 1 regular

has boundary conditions y(−1) = y(1) = 0. It is important to specify that, though being definedregular, it has the coefficients p(x) and r(x) not defined in the endpoints and hence it lookssingular. This ‘singular’ behavior wreaks a loss of order. The results in Table 2 bear out the slowconvergence and the numerical order reaches the same constant value for every eigenvalue andorder of the method. Here it is known from [14] that λ0 = 3.559279966, λ9 = 258.8005854 andλ24 = 1572.635284.

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering (ESCMSE)

Page 9: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

Numerical Solution of Sturm-Liouville Problems 9

Table 2: Numerical results for Test problem 2.

p = 4 p = 6 p = 8

Mesh Error Order Error Order Error Order

1000 1.57e-05 1.50 1.41e-05 1.50 1.26e-05 1.50λ0 2000 5.56e-06 1.50 5.00e-06 1.50 4.44e-06 1.50

3000 3.03e-06 1.50 2.72e-06 1.50 2.42e-06 1.504000 1.97e-06 - 1.77e-06 - 1.57e-06 -6000 2.93e-06 1.50 2.63e-06 1.50 2.34e-06 1.50

λ9 9000 1.59e-06 1.50 1.43e-06 1.50 1.27e-06 1.5012000 1.04e-06 1.50 9.31e-07 1.50 8.27e-07 1.5015000 7.41e-07 - 6.66e-07 - 5.92e-07 -10000 2.13e-06 1.50 1.91e-06 1.50 1.70e-06 1.50

λ24 15000 1.16e-06 1.50 1.04e-06 1.50 9.25e-07 1.5020000 7.53e-07 1.50 6.76e-07 1.50 6.00e-07 1.5025000 5.38e-07 - 4.84e-07 - 4.30e-07 -

Problem 3. The truncated hydrogen equation (see [14]) is defined as,

−y′′(x) +

(2

x2− 1

x

)y(x) = λy(x), x ∈ [0, 1000],

a = 0 LP,b = 1000 regular.

The only condition is y(1000) = 0. The eigenvalues are

λk = − 1

(2k + 4)2, k = 0, 1, . . .

Since a = 0 is LP, no boundary condition is required and initial methods approximate the problemin the initial point. Since q(x) is not defined in a, we also truncate the interval (see [13]) andchoose a > 0 close to zero. Moreover, the results in Table 3 show that the numerical order isgained, the convergence for order 8 is rather faster and the accuracy improves with the higherorder. We emphasize that, on a truncated interval, a good eigenvalue estimation is reached untilk = 9, since when k increases the eigenfunction is not zero in the right endpoint and oscillationsrange on a greater interval. In order to compare the results with the next problem we have alsodrawn the eigenfunction associated to λ4 in Figure 1 (left).

Problem 4. The Hydrogen atom equation in problem 3 is integrated for x ∈ [0,∞], where

b = ∞ LP

With respect to the previous example, both endpoints are LP and no boundary condition is given, sowe consider one initial and final methods to approximate the problem in both endpoints. Moreoverthe upper unbounded interval is transformed by means of the simple change of variable

xi = 1− 1√1 + xi

∈ [0, 1].

Obviously a constant step size in [0, 1] gives a solution with variable step size in the original interval,as it is possible to see in Figure 1 (right). We note that the solution, obtained in the interval (0,∞),is truncated in b = 1000 in order to see the choice of the mesh selection in comparison to Figure 1(left). Conversely to Problem 3 few points ensure a good approximation and numerical orderis preserved. As noted in the other examples greatest accuracy is guaranteed by higher ordermethods.

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering (ESCMSE)

Page 10: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

10 P. Amodio, G. Settanni

Table 3: Numerical results for Test problem 3.

p = 4 p = 6 p = 8

Mesh Error Order Error Order Error Order

500 2.18e-03 4.23 9.77e-04 6.89 2.00e-04 9.42λ0 1000 1.16e-04 2.96 8.22e-06 6.64 2.92e-07 11.15

1500 3.49e-05 3.62 5.56e-07 6.37 3.17e-09 18.342000 1.23e-05 - 8.91e-08 - 1.61e-11 -500 7.36e-04 4.64 1.17e-04 7.61 9.75e-06 10.181000 2.95e-05 3.05 5.98e-07 6.90 8.38e-09 11.23

λ4 1500 8.57e-06 3.68 3.64e-08 6.45 8.82e-11 14.282000 2.97e-06 3.84 5.68e-09 6.24 1.45e-12 6.812500 1.26e-06 - 1.41e-09 - 3.17e-13 -1000 1.44e-05 3.02 2.35e-07 6.98 2.54e-09 11.22

λ9 1500 4.23e-06 3.67 1.39e-08 6.48 2.69e-11 10.952000 1.47e-06 3.84 2.15e-09 6.27 1.15e-12 8.722500 6.24e-07 - 5.31e-10 - 1.65e-13 -

Table 4: Numerical results for Test problem 4.

p = 4 p = 6 p = 8

Mesh Error Order Error Order Error Order

100 2.79e-06 3.99 4.62e-08 5.96 1.60e-09 7.89λ0 150 5.53e-07 3.99 4.13e-09 5.98 6.51e-11 7.99

200 1.75e-07 4.00 7.40e-10 5.99 6.53e-12 7.55250 7.19e-08 - 1.94e-10 - 1.21e-12 -200 3.16e-04 3.96 2.14e-05 5.90 2.21e-06 7.80

λ4 400 2.03e-05 3.99 3.59e-07 5.97 9.88e-09 7.11600 4.03e-06 3.99 3.19e-08 5.98 5.53e-10 12.48800 1.28e-06 - 5.72e-09 - 1.52e-11 -500 8.14e-04 3.95 6.87e-05 5.89 7.70e-06 7.80

λ9 1000 5.25e-05 3.98 1.16e-06 5.96 3.46e-08 7.801500 1.04e-05 3.99 1.03e-07 5.98 1.46e-09 9.742000 3.31e-06 - 1.85e-08 - 8.89e-11 -2000 2.76e-03 3.93 3.73e-04 5.84 6.09e-05 7.74

λ24 4000 1.81e-04 3.97 6.53e-06 5.95 2.85e-07 7.936000 3.61e-05 3.99 5.85e-07 5.97 1.15e-08 8.148000 1.15e-05 - 1.05e-07 - 1.10e-09 -

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering (ESCMSE)

Page 11: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

Numerical Solution of Sturm-Liouville Problems 11

0 200 400 600 800 1000−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

x

y 4(x)

0 200 400 600 800 1000−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

x

y 4(x)

Figure 1: Eigenfunctions y4(x) computed by the order 6 method with 300 points in the interval[0, 1000] (left) and in the interval (0,∞) truncated at b = 1000 (right).

Problem 5. The Legendre equation (see [11]) is defined as

−((1− x2)y′)′(x) +1

4y(x) = λy(x), x ∈ [−1, 1],

a = −1 LCNOb = 1 LCNO

The boundary conditions [y, u](−1) = −(py′)(−1) = 0 and [y, u](1) = −(py′)(1) = 0 are obtainedfrom (2) setting a1 = b1 = 1, a2 = b2 = 0, u(x) = 1 and v(x) = ln ((1 + x)/(1− x)). Theeigenvalues are

λk =

(k +

1

2

)2

, k = 0, 1, . . . ,

while the Legendre polynomials represent the eigenfunctions associated to λk. Since p is nullin the endpoints, an initial and final method to approximate both endpoints substitute for theboundary conditions. The results obtained for small k show that 20 points are enough for a verygood approximation, consequently the numerical order is estimated for k = 9, 24, 49. We underlinethat the numerical order is preserved and sometimes exceeds the order expected. Moreover, thenumber of points required to reach a prescribed accuracy is proportional to k and the higher ordermethods guarantee a better accuracy. Furthermore in Figure 2 the eigenfunctions associated tothe eigenvalue λ4 and λ24 are drawn, respectively.

5 Conclusion

The results shown in the section 4 highlight as the methods work well on regular and singularproblems excepted when the Sturm-Liouville coefficients are not defined in the endpoints of theinterval and it is not possible to consider a truncated interval (as, for example, in Problem 3 andProblem 5). This behavior is worth treating in a deeper way in a next paper. On the otherhand it is important to point out that the number of mesh points is high unless the Problem 4.Consequently, we will consider a variable step size in order to reduce the number of points and tocompare the used approach with other codes solving Sturm-Liouville problems as SLEIGN ([12]).

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering (ESCMSE)

Page 12: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

12 P. Amodio, G. Settanni

Table 5: Numerical results for Test problem 5.

p = 4 p = 6 p = 8

Mesh Error Order Error Order Error Order

20 3.67e-02 3.61 5.69e-03 6.10 2.14e-04 8.9340 3.00e-03 5.55 8.28e-05 6.80 4.38e-07 9.25

λ9 60 3.16e-04 6.76 5.27e-06 6.78 1.03e-08 9.4380 4.52e-05 9.22 7.49e-07 6.74 6.83e-10 9.54100 5.77e-06 - 1.66e-07 - 8.13e-11 -100 1.13e-02 1.19 2.81e-03 2.56 1.14e-03 4.97200 4.94e-03 4.50 4.75e-04 5.90 3.65e-05 7.93

λ24 300 7.96e-04 5.53 4.33e-05 6.37 1.47e-06 8.59400 1.62e-04 6.40 6.94e-06 6.52 1.24e-07 8.91500 3.88e-05 - 1.62e-06 - 1.70e-08 -500 7.03e-03 2.70 1.72e-03 4.38 4.02e-04 6.371000 1.08e-03 5.06 8.24e-05 6.13 4.85e-06 8.22

λ49 1500 1.39e-04 6.05 6.87e-06 6.42 1.73e-07 8.732000 2.44e-05 7.23 1.08e-06 6.51 1.41e-08 8.972500 4.85e-06 - 2.54e-07 - 1.90e-09 -

−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1−0.5

0

0.5

1

x

y 4(x)

−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

x

y 24(x

)

Figure 2: Eigenfunctions y4(x) and y24(x) computed by the order 6 method with 300 points.

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering (ESCMSE)

Page 13: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for

Numerical Solution of Sturm-Liouville Problems 13

References

[1] L. Aceto, P. Ghelardoni and G. Gheri, An algebraic procedure for the spectral corrections usingthe miss-distance functions in regular and singular Sturm-Liouville problems, SIAM J. Numer.Anal. 44 (2006), 2227–2243.

[2] L. Aceto, P. Ghelardoni and C. Magherini, BVMs for Sturm-Liouville eigenvalue estimateswith general boundary conditions, J. Numer. Anal. Ind. Appl. Math. 4 (2009), 113–127.

[3] L. Aceto, P. Ghelardoni and C. Magherini, Boundary value methods as an extension of Nu-merov’s method for Sturm-Liouville eigenvalue estimates, Appl. Numer. Math. 59 (7) (2009),1644–1656.

[4] P. Amodio and G. Settanni, Variable step/order generalized upwind methods for the numericalsolution of second order singular perturbation problems, J. Numer. Anal. Ind. Appl. Math. 4(2009), 65–76.

[5] P. Amodio and G. Settanni, A deferred correction approach to the solution of singularly per-turbed BVPs by high order upwind methods: implementation details, in: Numerical analysisand applied mathematics - ICNAAM 2009. T.E. Simos, G. Psihoyios and Ch. Tsitouras (eds.),AIP Conf. Proc. 1168, issue 1 (2009), 711–714.

[6] P. Amodio and G. Settanni, High order finite difference schemes for the solution of secondorder initial value problems, J. Numer. Anal. Ind. Appl. Math. 5 (2010), 3–10.

[7] P. Amodio and G. Settanni, High order finite difference schemes for the numerical solutionof eigenvalue problems for IVPs in ODEs, in: Numerical analysis and applied mathematics -ICNAAM 2010. T.E. Simos, G. Psihoyios and Ch. Tsitouras (eds.), AIP Conf. Proc. 1281,issue 1 (2010), 202–204.

[8] P. Amodio and I. Sgura, High-order finite difference schemes for the solution of second-orderBVPs, J. Comput. Appl. Math. 176 (2005), 59–76.

[9] P. Amodio and I. Sgura, High order generalized upwind schemes and numerical solution ofsingular perturbation problems, BIT 47 (2007), 241-257.

[10] L. Brugnano and D. Trigiante, Solving Differential Problems by Multistep Initial and BoundaryValue Methods, Gordon and Breach Science Publishers, Amsterdam, 1998.

[11] W.N. Everitt, A catalogue of Sturm-Liouville differential equations, in: Sturm-Liouville The-ory. Past and Present, W.O. Amrein, A.M. Hinz and D.P. Pearson (eds.), Birkauser, 2005.

[12] M. Marletta, Certification of algorithm 700: numerical tests of the SLEIGN software forSturm-Liouville problems, ACM Trans. Math. Software 17 (4) (1991), 481–490.

[13] M. Marletta and J.D. Pryce, LCNO Sturm-Liouville problems: computational difficulties andexamples, Numer. Math. 69 (3) (1995), 303-320

[14] J.D. Pryce, A test package for Sturm-Liouville solvers, ACM Trans. Math. Software 25 (1)(1999), 21-57.

[15] J.D. Pryce, Numerical solution of Sturm-Liouville problems. Monographs on Numerical Anal-ysis. Oxford Science Publications. The Clarendon Press, Oxford University Press, New York,1993.

c⃝ 2011 European Society of Computational Methods in Sciences and Engineering (ESCMSE)

Page 14: A Matrix Method for the Solution of Sturm-Liouville Problemsjnaiam.org/uploads/jnaiam_6_1.pdf · 2 P. Amodio, G. Settanni The unspecified parameter , called eigenvalue, exists for