MPEMathematical Problems in Engineering1563-51471024-123XHindawi Publishing Corporation18425310.1155/2012/184253184253Research ArticleDirect Two-Point Block One-Step Method for Solving General Second-Order Ordinary Differential EquationsAbdul MajidZanariah1,2MokhtarNur Zahidah1SuleimanMohamed1,2WeberGerhard-Wilhelm1Institute for Mathematical ResearchUniversiti Putra MalaysiaSelangor Darul Ehsan43400 SerdangMalaysiaupm.edu.my2Mathematics DepartmentFaculty of ScienceUniversiti Putra MalaysiaSelangor Darul Ehsan43400 SerdangMalaysiaupm.edu.my2012301201220122505201119092011300920112012Copyright © 2012 Zanariah Abdul Majid et al.This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

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 the PE(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.

1. Introduction

In this paper, we are considering solving directly the general second-order initial value problems (IVPs) for systems of ODEs in the formy=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 . 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 , 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  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 , 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  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 , 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  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 of yn+1 and yn+2  simultaneously, the interval of [a,b] is divided into a series of blocks with each block containing two points as shown in Figure 1.

Block one-step method.

In Figure 1, 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 of yn+1 and yn+2 at the points xn+1 and xn+2 by integrating once and twice over (1.1) with respect to  x. We begin to evaluate the yn+1 and yn+1 by integrating once and twice (1.1) over the interval [xn,xn+1]:xnxn+1y(x)dx=xnxn+1f(x,y,y)dx,  xnxn+1xnxy(x)dxdx=xnxn+1xnxf(x,y,y)dxdx. Let xn+1=xn+h which gives 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: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: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:[00000-110000000-11][yn-1ynyn+1yn+2]=h([01-100100001-10010][yn-1ynyn+1yn+2])+h2([0512812-1120724624-1240-1128125120-1241024324][fn-1fnfn+1fn+2]). The order of this developed method is identified by referring to . The two-point one-step block method for ODEs can be written in a matrix difference equation as follows:αYm=hβYm+h2γFm, where α,β, and γ are the coefficients with the m-vector Ym, Ym, and Fm be defined asYm=[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 constants Cq, in  the formulae is defined asC0=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),  where  q=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).

For q=0,C0=j=0310!j0αj=α0+α1+α2+α3=+[0-100]+[010-1]+=.

For q=1,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-(++[-1011]+[00-10])=. For q=2,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)-(1+2[-1011]+3[00-10])-  (+[512724-112-124]++[-112-124512324])=.

For q=3,C3=j=0313!j3αj-j=0312!j2βj-j=0311!j1γj=.

For q=4,C4=j=0314!j4αj-j=0313!j3βj-j=0312!j2γj=.

For q=5,C5=j=0315!j5αj-j=0314!j4βj-j=0313!j3γj=[124145-124-7360]. The method is order p if C0=C1==Cp+1=0 and Cp+20 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 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 initial h used is as follows: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 approximating yn+1,0(p),  yn+1,0(p),  yn+2,0(p), and yn+2,0(p) using the predictor formulas is as follows:

for  i=1 to 2 do

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),yn+i,0(p))

end for

Computing approximations yn+1,0(c),yn+1,0(c),yn+2,0(c), and  yn+2,0(c) using corrector formulas is as follows:

for r=0  do

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)),

end for

for r=1,2,  until convergence do

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)),

for  i=1 to 2 do  E:  f(xn+i,yn+i,r+1(c),yn+i,r+1(c))

end for

end for

The convergence test:|(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)t  is 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: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(Ei)t=|(yi)t-(y(xi))tA+B(y(xi))t|. For the evaluation of maximum error, it is defined as follow:MAXE=max1iTS(max1iN(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 . 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 byhnew=C×hold×(TOLLTE)1/(k+1),if  (hnew2×hold),  then  hnext=2×hold,else    hnext=hold, where C  = 0.5 is a safety factor. The algorithm when the step failure occurs ishnext=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:y=f=θy+λy.

Firstly, the test equation in (4.1) is substituted into the predictor formula (3.2). The evaluation of fn+1,0p  and fn+2,0p will be substituted into the right-hand side of (3.3) when r=0 as shown below:fn+1,0p=θyn+1,0p+λyn+1,0p,fn+2,0p=θyn+2,0p+λyn+2,0p, where yn+1,0p  , yn+1,0p, yn+2,0p, and yn+2,0p  in (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: 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.

Stability region for direct block one-step method when r=0.

In case r=1, the stability polynomial is obtained as follows:

r=1:

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.

Stability region for direct block one-step method when r=1.

The stability region is plotted using MATHEMATICA, and the shaded region inside the boundary in Figures 2 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 .

Problem 1.

We have 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: 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 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: 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 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: 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 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 Problems 13 in Tables 24 are solved using the proposed method and the method in . The results in terms of total steps and execution times for solving Problems 13 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-8  and compared with the solutions obtained by the MATLAB built-in solver ode45.

Results of total steps and time for Problem 1.

Results of total steps and time for Problem 2.

Results of total steps and time for Problem 3.

Solution of Problem 4 when TOL = 10−8.

In Figures 4, 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 Table 1, 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).

The ratios execution times and steps for solving Problems 1 to 3.

 TOL PROB 1 PROB 2 PROB 3 RSTEP RTIME RSTEP RTIME RSTEP RTIME 10-2 2.53 1.90 2.83 1.55 2.56 1.20 10-4 2.38 2.31 2.88 1.57 2.45 1.32 10-6 2.89 3.05 3.11 2.84 3.19 2.30 10-8 4.74 5.26 4.34 1.49 3.47 3.17

Comparison between 2P(A) and 2P(B) methods for solving Problem 1.

TOLMethodTSFSMAXEAVERRFCNTIME
10−22P(A)4823.20591e-004  1.28467e-004  3851002
2P(B)1903.88324e-0032.89565e-003121527

10−42P(A)14323.69289e-006  1.48547e-006  11452423
2P(B)6003.46171e-0052.81402e-0053671047

10−62P(A)54632.91502e-008  7.74544e-009  43699287
2P(B)18903.43754e-0072.76828e-00711333045

10−82P(A)281932.43829e-011  9.79663e-012  2255347821
2P(B)59503.44148e-0092.75811e-00935719093

Comparison between 2P(A) and 2P(B) methods for solving Problem 2.

TOLMethodTSFSMAXEAVERRFCNTIME
10−22P(A)1744.64239e-004  1.01900e-004  137408
2P(B)601.29794e-0032.48275e-00447264

10−42P(A)4635.27751e-006  9.23287e-007  369708
2P(B)1614.19030e-0057.96402e-006131452

10−62P(A)17122.35992e-008  5.04232e-009  13692694
2P(B)5514.24624e-0076.60118e-008429950

10−82P(A)75024.50146e-011  7.04651e-012  17413844
2P(B)17314.31085e-0096.26858e-01013432588

Comparison between 2P(A) and 2P(B) methods for solving Problem 3.

TOLMethodTSFSMAXEAVERRFCNTIME
10−22P(A)2371.42058e-004  3.37359e-005  185296
2P(B)901.47268e-0034.24039e-00469247

10−42P(A)5421.41231e-006  2.21945e-007  433597
2P(B)2202.73310e-0059.95954e-006177451

10−62P(A)20116.04402e-009  9.73203e-010  16092252
2P(B)6309.51564e-0072.58666e-007503980

10−82P(A)66614.12406e-011  8.11194e-012  53297700
2P(B)19201.25592e-0082.60498e-00915372426

In Table 2, 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 Tables 3 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.

NotationsTOL:

Tolerance

MTD:

Method employed

TS:

Total steps taken

FS:

Total failure steps

MAXE:

Magnitude of the maximum error of the computed solution

AVERR:

The average error

FCN:

Total function calls

TIME:

The execution time taken in microseconds

2P(A):

Implementation of the direct block method in  by reducing the problem to system of first-order ODEs

2P(B):

Implementation of the direct two-point block one-step method by solving the problem directly

RSTEP:

The ratio steps, TS2P(A)/TS2P(B)

RTIME:

The ratio execution times, TIME2P(A)/TIME2P(B)

Acknowledgment

The authors would like to thank the Universiti Putra Malaysia for providing financial support through Graduate Research Fellowship (GRF) during the study period.

RosserJ. B.A Runge-Kutta for all seasonsSIAM Review19679417452021924210.1137/1009069ZBL0243.65041ShampineL. F.WattsH. A.Block implicit one-step methodsMathematics of Computation196923731740026485410.1090/S0025-5718-1969-0264854-5ZBL0187.40202WorlandP. B.Parallel methods for the numerical solution of ordinary differential equationsInstitute of Electrical and Electronics Engineers19762510104510480474836ZBL0359.65063MehrkanoonS.MajidZ. A.SuleimanM.A variable step implicit block multistep method for solving first-order ODEsJournal of Computational and Applied Mathematics201023392387239410.1016/j.cam.2009.10.0232577775ZBL1183.65094MajidZ. A.SuleimanM. B.Implementation of four-point fully implicit block method for solving ordinary differential equationsApplied Mathematics and Computation2007184251452210.1016/j.amc.2006.05.1692294867ZBL1114.65080MajidZ. A.AzmiN. A.SuleimanM.Solving second order ordinary differential equations using two point four step direct implicit block methodEuropean Journal of Scientific Research200931129362-s2.0-67649801832IbrahimZ. B.SuleimanM. B.IsmailF.Fully implicit two point block backward difference formula for solving a first order initial value problemsScience Putra Research Bulletin20031121417ChakravartiP. C.WorlandP. B.A class of self-starting methods for the numerical solution of y=f(x,y)BIT1971113683830298951ZBL0233.65042MajidZ. A.SuleimanM. B.IsmailF.OthmanM.2-point implicit block one-step method half Gauss-Seidel for solving first order ordinary differential equationsMatematika20031991100FatunlaS. O.Block methods for second order ODEsInternational Journal of Computer Mathematics199141556310.1080/00207169108804026ZBL0744.65045LambertJ. D.Computational Methods in Ordinary Differential Equations1973New York, NY, USAJohn Wiley & Sons0423815GearC. W.Numerical Initial Value Problems in Ordinary Differential Equations1971Englewood Cliffs, NJ, USAPrentice-Hall0315898