# Direct Two-Point Block One-Step Method for Solving General Second-Order Ordinary Differential Equations

Authors: Zanariah Abdul Majid; Nur Zahidah Mokhtar; Mohamed Suleiman
Journal: Mathematical Problems in Engineering
 (2012)

---

## Abstract

A direct two-point block one-step method for solving general second-order ordinary differential equations (ODEs) directly is presented in this paper. The one-step block method will solve the second-order ODEs without reducing to first-order equations. The direct solutions of the general second-order ODEs will be calculated at two points simultaneously using variable step size. The method is formulated using the linear multistep method, but the new method possesses the desirable feature of the one-step method. The implementation is based on the predictor and corrector formulas in thePE(CE)m mode. The stability and precision of this method will also be analyzed and deliberated. Numerical results are given to show the efficiency of the proposed method and will be compared with the existing method.


---

## Body

## 1. Introduction

In this paper, we are considering solving directly the general second-order initial value problems (IVPs) for systems of ODEs in the form(1.1)y′′=f(x,y,y′),y(a)=y0,y′(a)=y0′,x∈[a,b].
Equation in (1.1) arises from many physical phenomena in a wide spectrum of applications especially in the science and engineering areas such as in the electric circuit, damped and undamped spring mass and some other areas of application. We will also consider solving general second order as in (1.1) using the direct block one-step method. Block methods for numerical solutions of ODEs have been proposed by several researchers such as in [1–5]. The common block methods used to solve the problems can be categorized as one-step block method and multistep block method.One-step block method such as the implicit Runge-Kutta method is also being referred to as one previous point to obtain the solution. The multistep block method in the form of Adams type formula is presented in [5, 6]. In [7], the block backward differentiation formula (BBDF) for solving stiff ODEs has been introduced and the solutions referred to as more than one previous point. The works in [6] showed the proposed two-point four-step block method presented as in a simple form of Adams Moulton method for solving second-order ODEs directly.The block method of Runge-Kutta type has been explored in [1], and it is suggested that a block of new approximation values is used simultaneously for solving first-order ODEs. The works in [3, 8, 9] have been considered in solving (1.1) using the block one-step method, while [3] has proposed a two-point implicit block one-step method for solving second-order ODEs directly and suggested that the method is suitable to be parallel.In [9], Majid et al. have derived the two-point block method for solving first-order ODEs by using the closest point in the interval, that is, [xn,xn+1] and [xn+1,xn+2]. The Gauss Seidel iteration was implemented in the proposed block method. The approach in this research is to extend the idea in [9] for solving (1.1) directly without reducing system of first-order ODEs using two-point block one-step method.


## 2. Formulation of the Method

In order to compute the two approximation values ofyn+1 and yn+2simultaneously, the interval of [a,b] is divided into a series of blocks with each block containing two points as shown in Figure 1.Figure 1
Block one-step method.In Figure1, we observed that kth block contains xn,xn+1 and xn+2, where xn becomes the starting point and xn+2 is the last point in the kth block with step size h. The approximations values of yn+1 and yn+2 are computed simultaneously. The evaluation solution at the last point in kth block will be restored as the initial values for (k+1)th block. The same procedure is used to compute the solutions for the next block until the end of the interval. The evaluation information from the previous step in a block could be used for other steps of the same block only. During the calculations of iteration, the final values of yn+2 at the point xn+2 are taken as the initial values for the next iteration.We obtained the approximation values ofyn+1 and yn+2 at the points xn+1 and xn+2 by integrating once and twice over (1.1) with respect tox. We begin to evaluate the yn+1′ and yn+1 by integrating once and twice (1.1) over the interval [xn,xn+1]:(2.1)∫xnxn+1y′′(x)dx=∫xnxn+1f(x,y,y′)dx,∫xnxn+1∫xnxy′′(x)dxdx=∫xnxn+1∫xnxf(x,y,y′)dxdx.
Let xn+1=xn+h which gives
(2.2)y′(xn+1)-y′(xn)=∫xnxn+1f(x,y,y′)dx,y(xn+1)-y(xn)-hy′(xn)=∫xnxn+1(xn+1-x)f(x,y,y′)dx.
Then, f(x,y,y′) in (2.2) will be replaced with Lagrange interpolation polynomial that involves interpolation points in the block at (xn,fn),(xn+1,fn+1) and(xn+2,fn+2). Taking x=xn+2+sh,s=(x-xn+2)/h, and dx=hds and replacing into (2.2). Then, the limit of integration in (2.2) will be from −2 to −1. The corrector formulae will be obtained using MATHEMATICA. The formulae of yn+1′and yn+1 are obtained as follows:(2.3)yn+1′=yn′+h12(5fn+8fn+1-fn+2),yn+1=yn+hyn′+h224(7fn+6fn+1-fn+2).
To approximate the value of yn+2′ and  yn+2, we take xn+2=xn+2h by integrating once and twice (1.1) over the interval [xn+1,xn+2]and apply the same process. The limit of integration will be from −1 to 0, and the following corrector formulae will be obtained:(2.4)yn+2′=yn+1′+h12(-fn+8fn+1+5fn+2),yn+2=yn+1+hyn+1′+h224(-fn+10fn+1+3fn+2).
The formulae (2.3) and (2.4) may be rewritten in the form of matrix difference equation as follows:(2.5)[00000-110000000-11][yn-1ynyn+1yn+2]=h([01-100100001-10010][yn-1′yn′yn+1′yn+2′])+h2([0512812-1120724624-1240-1128125120-1241024324][fn-1fnfn+1fn+2]).
The order of this developed method is identified by referring to [10–12]. The two-point one-step block method for ODEs can be written in a matrix difference equation as follows:(2.6)αYm=hβYm′+h2γFm,
where α,β, and γ are the coefficients with the m-vector Ym,Ym′, and Fm be defined as(2.7)Ym=[yn-1,yn,yn+1,yn+2]T,Ym′=[yn-1′,yn′,yn+1′,yn+2′]T,Fm=[fn-1,fn,fn+1,fn+2]T.By applying the formulae for the constantsCq, in [10] the formulae is defined as(2.8)C0=∑j=0kαj,C1=∑j=0k(jαj-βj),C2=∑j=0k(j22!αj-jβj-γj),⋮Cq=∑j=0k(jqq!αj-jq-1(q-1)!βj-jq-2(q-2)!γj),whereq=3,4,5,….
Therefore, the order and error constant of the two-point one-step block method can be obtained by using equation in (2.8).Forq=0,(2.9)C0=∑j=0310!j0αj=α0+α1+α2+α3=[0000]+[0-100]+[010-1]+[0001]=[0000].Forq=1,(2.10)C1=∑j=0311!j1αj-∑j=0310!j0βj=11⋅α1+21⋅α2+31⋅α3-(β0+β1+β2+β3)=1[0-100]+2[010-1]+3[0001]-([0000]+[1100]+[-1011]+[00-10])=[0000].
For q=2,(2.11)C2=∑j=0312!j2αj-∑j=0311!j1βj-∑j=0310!j0γj=12(12⋅α1+22⋅α2+32⋅α3)-(11⋅β1+21⋅β2+31⋅β3)-(γ0+γ1+γ2+γ3)=12(1[0-100]+4[010-1]+9[0001])-(1[1100]+2[-1011]+3[00-10])-([0000]+[512724-112-124]+[8126248121024]+[-112-124512324])=[0000].Forq=3,(2.12)C3=∑j=0313!j3αj-∑j=0312!j2βj-∑j=0311!j1γj=[0000].Forq=4,(2.13)C4=∑j=0314!j4αj-∑j=0313!j3βj-∑j=0312!j2γj=[0000].Forq=5,(2.14)C5=∑j=0315!j5αj-∑j=0314!j4βj-∑j=0313!j3γj=[124145-124-7360]≠[0000].
The method is order p if C0=C1=⋯=Cp+1=0 and Cp+2≠0 is the error constant. Thus, we conclude that the method in (2.3) and (2.4) is of the order 3 and the error constant is
(2.15)Cp+2=C5=[124,145,-124,-7360]T.


## 3. Implementation of the Method

The initial starting point at each block are obtained by using Euler method as predictor and the initialh used is as follows:(3.1)hinitial=(TOL2)1/(p+1),
where TOL is the tolerance and p is the order of the method. Then, the calculations are corrected using the corrector formulae in (2.3) and (2.4). For the next block, the same techniques are repeated to compute the approximation values of yn+1 and yn+2 simultaneously until the end of the interval. We use r function evaluations per step at the corrector formulae, that is, PE(CE)r, where P, E, and C indicate the predictor, evaluate the function f, and the corrector, respectively.Algorithm 3.1.
Computing approximatingyn+1,0′(p),yn+1,0(p),yn+2,0′(p), and  yn+2,0(p) using the predictor formulas is as follows: fori=1 to 2 do(3.2)P:yn+i,0′(p)=yn+(i-1)′(p)+hfn+(i-1)(p),yn+i,0(p)=yn+(i-1)(p)+hyn+(i-1)′(p)+h22fn+(i-1)(p),E:f(xn+i,yn+i,0(p),y′n+i,0(p))end forComputing approximations yn+1,0′(c),yn+1,0(c),yn+2,0′(c), andyn+2,0(c) using corrector formulas is as follows: forr=0do(3.3)C:yn+1,r+1′(c)=yn′(c)+h12(5fn(c)+8fn+1,0(p)-fn+2,0(p)),yn+1,r+1(c)=yn(c)+hyn′(c)+h224(7fn(c)+6fn+1,0(p)-fn+2,0(p)),yn+2,r+1′(c)=yn+1,r+1′(c)+h12(-fn(c)+8fn+1,0(p)+5fn+2,0(p)),yn+2,r+1(c)=yn+1,r+1(c)+hyn+1,r+1′(c)+h224(-fn(c)+10fn+1,0(p)+3fn+2,0(p)),fori=1 to 2 do(3.4)E:f(xn+i,yn+i,r+1(c),y′n+i,r+1(c))end forend forforr=1,2,…until convergence do(3.5)C:yn+1,r+1′(c)=yn′(c)+h12(5fn(c)+8fn+1,0(c)-fn+2,0(c)),yn+1,r+1(c)=yn(c)+hyn′(c)+h224(7fn(c)+6fn+1,0(c)-fn+2,0(c)),yn+2,r+1′(c)=yn+1,r+1′(c)+h12(-fn(c)+8fn+1,0(c)+5fn+2,0(c)),yn+2,r+1(c)=yn+1,r+1(c)+hyn+1,r+1′(c)+h224(-fn(c)+10fn+1,0(c)+3fn+2,0(c)),fori=1 to 2 do(3.6)E:f(xn+i,yn+i,r+1(c),y′n+i,r+1(c))end for end forThe convergence test:(3.7)|(yn+2,r+1)t-(yn+2,r)tA+B(yn+2,r+1)t|<0.1×TOL,
where r is the number of iterations and (y)tis the tth component of the approximate. A=1, B=0 correspond to the absolute error test. A=1, B=1 correspond to the mixed test and finally A=0, B=1 correspond to the relative error test. The mixed error test is used in all tested problems. If the convergence test is satisfied, then we control the error in the current block by performing the local truncation error as follows:(3.8)LTE=|yn+2(k)-yn+2(k-1)|,
where k is the order of corrector formula. The errors calculated in the code is defined as(3.9)(Ei)t=|(yi)t-(y(xi))tA+B(y(xi))t|.
For the evaluation of maximum error, it is defined as follow:(3.10)MAXE=max⁡1≤i≤TS(max⁡1≤i≤N(Ei)t),
where N is the number of equation in the system and TS is the number of successful steps.In order to make the selection of the next step size, we follow again the techniques used in [9]. If LTE ≤ TOL, then the next step size remains constant or double, otherwise the step size will be half. The step size when the integration steps are successful is given by(3.11)hnew=C×hold×(TOLLTE)1/(k+1),if(hnew≥2×hold),thenhnext=2×hold,elsehnext=hold,
where C= 0.5 is a safety factor. The algorithm when the step failure occurs is(3.12)hnext=12×hold.


## 4. Stability of the Method

In this section, we will discuss the stability of the proposed method derived in the previous section on a linear general second-order problem:(4.1)y′′=f=θy′+λy.Firstly, the test equation in (4.1) is substituted into the predictor formula (3.2). The evaluation of fn+1,0pand fn+2,0p will be substituted into the right-hand side of (3.3) when r=0 as shown below:(4.2)fn+1,0p=θyn+1,0′p+λyn+1,0p,fn+2,0p=θyn+2,0′p+λyn+2,0p,
where yn+1,0′p,yn+1,0p,yn+2,0′p, and yn+2,0pin (4.2) are obtained in (3.2) after substituted the test equation (4.1). Then, the formulae are written in the matrix form and setting the determinant of the matrix to zero. Hence, the stability polynomial is obtained:r=0:
(4.3)t2(1+25hθ12+9h2θ24+5h3θ36+h4λ43+h2λ8-h3θλ2+h4θ2λ12-h5θ3λ12-37h4λ2144-h5θλ29-h6θ2λ29-h6λ336+h7θλ316+h8λ436)+t3(-2-13hθ6-7h2θ23-5h3θ36-h4λ43-17h2λ4-47h3θλ12-7h4θ2λ4-7h5θ3λ12-115h4λ272-19h5θλ218-7h6θ2λ218-7h6λ336-17h7θλ3144-h8λ472)+t4(1+hθ12+h2θ212+h2λ8+h3θλ12+h4λ248)=0.Figure 2 showed the stability region of the direct block one-step method when r=0.Figure 2
Stability region for direct block one-step method whenr=0.In caser=1, the stability polynomial is obtained as follows:r=1:(4.4)t2(1+2hθ+25h2θ212+19h3θ312+h4θ43+5h5θ518+h6θ69+748h3θλ-1348h4θ2λ+14h5θ3λ+1772h6θ4λ+118h7θ5λ+11h4λ2288-83144h5θλ2+101432h6θ2λ2+13432h7θ3λ2-17432h8θ4λ2-199h6λ31728-53288h7θλ3-7216h8θ2λ3-5432h9θ3λ3-29h8λ4324-17h9θλ41296+97h10θ2λ45184-h10λ5648+196h11θλ5+h12λ6648)+t3(-2-2hθ-13h2θ26-5h3θ33-h4θ43-5h5θ518-h6θ69-4h2λ-10324h3θλ-17h4θ2λ6-11h5θ3λ12-19h6θ4λ24-5h7θ5λ18-203h4λ2144-199144h5θλ2-365h6θ2λ2432-361432h7θ3λ2-127h8θ4λ2432-133h6λ3864-269h7θλ3864-23h8θ2λ354-73h9θ3λ3432-55h8λ41296-139h9θλ41296-289h10θ2λ45184-7h10λ5648-13h11θλ51296-h12λ61296)+t4(1+h2θ212+h3θ312+748h3θλ+548h4θ2λ+11h4λ2288+124h5θλ2+h6λ3192)=0.
Figure 3 showed the stability region of the direct block one-step method when r=1.Figure 3
Stability region for direct block one-step method whenr=1.The stability region is plotted using MATHEMATICA, and the shaded region inside the boundary in Figures2 and 3 demonstrate the stability region for the proposed method.


## 5. Numerical Results and Discussion

We have tested the performance of the proposed method on four problems. For the first three problems, a comparison is made between the solutions obtained in [9].Problem 1.
We have(5.1)y1′′=-y2+sinπx,y1(0)=0,y1′(0)=-1,y2′′=-y1+1-π2sinπx,y2(0)=1,y2′(0)=1+π,[0,10].
Solution: y1(x)=1-ex,y2(x)=ex+sinπx.
First-order systems:(5.2)y1′=y3,y2′=y4,y3′=-y2+sin⁡πx,y4′=-y1+1-π2sin⁡πx,y1(0)=0,y2(0)=1,y3(0)=-1,y4(0)=1+π.
Solution:y1(x)=1-ex, y2(x)=ex+sinπx, y3(x)=-ex, y4(x)=ex+πcosπx.Problem 2.
We have(5.3)y1′′=-e-xy2,y1(0)=1,y1′(0)=0,y2′′=2exy1′,y2(0)=1,y2′(0)=1,[0,π].
Solution: y1(x)=cosx,y2(x)=excosx.
First-order systems:(5.4)y1′=y3,y2′=y4,y3′=-e-xy2,y4′=2exy3,y1(0)=1,y2(0)=1,y3(0)=0,y4(0)=1.
Solution: y1(x)=cosx,y2(x)=excosx,y3(x)=-sinx,y4(x)=excosx-exsinx.Problem 3.
We have(5.5)y1′′=-y2′,y1(0)=0,y1′(0)=11-e-1,y2′′=-y1′,y2(0)=1,y2′(0)=11-e-1,[0,10].
Solution:  y1(x)=(1-e-x)/(1-e-1),y2(x)=(2-e-1-e-x)/(1-e-1).
First-order systems:(5.6)y1′=y3,y2′=y4,y3′=-y4,y4′=-y3,y1(0)=0,y2(0)=1,y3(0)=11-e-1,y4(0)=11-e-1.
Solution:y1(x)=(1-e-x)/(1-e-1),y2(x)=(2-e-1-e-x)/(1-e-1),y3(x)=(e-x)/(1-e-1),y4(x)=e-x/(1-e-1).Problem 4 (Van Der Pol oscillator).
We have(5.7)y′′-2ξ(1-y2)y′+y=0,y(0)=0,y′(0)=0.5,[0,10],
where we take ξ=0.025.The codes are written in C language and executed on DYNIX/ptx operating system. The numerical results for Problems1–3 in Tables 2–4 are solved using the proposed method and the method in [9]. The results in terms of total steps and execution times for solving Problems 1–3 are presented in histograms and graph lines in Figures 4, 5 and 6. The solutions of 2P(B) for solving Problem 4 are plotted in Figure 7 at tolerance 10-8and compared with the solutions obtained by the MATLAB built-in solver ode45.Figure 4
Results of total steps and time for Problem1.Figure 5
Results of total steps and time for Problem2.Figure 6
Results of total steps and time for Problem3.Figure 7
Solution of Problem4 when TOL = 10−8.In Figures4, 5 and 6, it is obvious that method 2P(B) requires less number of total steps as compared to method 2P(A) when solving the same given problems. It is also observed that the execution times of 2P(B) are faster than 2P(A) at all tested tolerances. This is expected since 2P(B) has less number of function calls; therefore, it has affected the computation time of 2P(B).In Table1, the RSTEP and RTIME are greater than 1.00 which shows that 2P(B) is more efficient compared to 2P(A). In fact, in some cases, the ratios are greater than 3.00, which indicates a clear advantage of method 2P(B) over 2P(A).Table 1
The ratios execution times and steps for solving Problems1 to 3.
TOLPROB 1PROB 2PROB 3RSTEPRTIMERSTEPRTIMERSTEPRTIME10-22.531.902.831.552.561.2010-42.382.312.881.572.451.3210-62.893.053.112.843.192.3010-84.745.264.341.493.473.17Table 2
Comparison between 2P(A) and 2P(B) methods for solving Problem1.
TOLMethodTSFSMAXEAVERRFCNTIME10−22P(A)4823.20591e-0041.28467e-00438510022P(B)1903.88324e-0032.89565e-00312152710−42P(A)14323.69289e-0061.48547e-006114524232P(B)6003.46171e-0052.81402e-005367104710−62P(A)54632.91502e-0087.74544e-009436992872P(B)18903.43754e-0072.76828e-0071133304510−82P(A)281932.43829e-0119.79663e-01222553478212P(B)59503.44148e-0092.75811e-00935719093Table 3
Comparison between 2P(A) and 2P(B) methods for solving Problem2.
TOLMethodTSFSMAXEAVERRFCNTIME10−22P(A)1744.64239e-0041.01900e-0041374082P(B)601.29794e-0032.48275e-0044726410−42P(A)4635.27751e-0069.23287e-0073697082P(B)1614.19030e-0057.96402e-00613145210−62P(A)17122.35992e-0085.04232e-009136926942P(B)5514.24624e-0076.60118e-00842995010−82P(A)75024.50146e-0117.04651e-012174138442P(B)17314.31085e-0096.26858e-01013432588Table 4
Comparison between 2P(A) and 2P(B) methods for solving Problem3.
TOLMethodTSFSMAXEAVERRFCNTIME10−22P(A)2371.42058e-0043.37359e-0051852962P(B)901.47268e-0034.24039e-0046924710−42P(A)5421.41231e-0062.21945e-0074335972P(B)2202.73310e-0059.95954e-00617745110−62P(A)20116.04402e-0099.73203e-010160922522P(B)6309.51564e-0072.58666e-00750398010−82P(A)66614.12406e-0118.11194e-012532977002P(B)19201.25592e-0082.60498e-00915372426In Table2, it can be observed that the maximum error of 2P(B) is one or two order larger than 2P(A) but still acceptable as it is within the given tolerance. This is expected since the code 2P(B) solved the given problem directly without reducing to system of first-order differential equations. We could observe that the RSTEP for Problem 1 is greater than 2 in Table 1.In Tables3 and 4, it is observed that the maximum error of 2P(B) is two or three order larger as compared to 2P(A) in solving Problems 2 and 3 but it is still within the given tolerances. In Figure 7, it is obvious that the 2P(B) solutions agree very well with the solutions obtained by the MATLAB built-in solver ode45 when solving Problem 4.


## 6. Conclusion

In this paper, we have constructed the direct two-point block one-step method which is efficient and suitable for solving general second-order ODEs directly. The block method has shown acceptable solutions and managed to solve the second-order ODE faster compared to the existing method.



---

*Source: 184253-2012-01-30.xml*