- Research
- Open access
- Published:

# Trigonometrically-fitted second derivative method for oscillatory problems

*SpringerPlus*
**volume 3**, Article number: 304 (2014)

## Abstract

A continuous Trigonometrically-fitted Second Derivative Method (CTSDM) whose coefficients depend on the frequency and stepsize is constructed using trigonometric basis functions. A discrete Trigonometrically-fitted second derivative method (TSDM) is recovered from the CTSDM as a by-product and applied to solve initial value problems (IVPs) with oscillating solutions. We discuss the stability properties of the TSDM and present numerical experiments to demonstrate the efficiency of the method.

### AMS Subject Classification

65L05; 65L06

## Introduction

In this paper, we consider the subclass of first order differential equation

with periodic or oscillating solutions where *f*:ℜ×ℜ^{m}→ℜ^{m}, *y*,*y*_{0}∈ℜ^{m}. Oscillatory IVPs frequently arise in areas such as classical mechanics, celestial mechanics, quantum mechanics, and biological sciences. Several numerical methods based on the use of polynomial basis functions have been developed for solving this class of important problems (see Lambert 1991, 1973, Hairer et al. in (Hairer and Wanner 1996), Hairer 1982, and Sommeijer 1993). Other methods based on exponential fitting techniques which take advantage of the special properties of the solution that may be known in advance have been proposed (see Simos 1998, Vanden Berghe et al. 2001a, Vanden Berghe et al. 2009, Vigo-Aguiar et al. 2003, Franco 2002, Fang et al. 2009, Nguyen et al. 2007, Ozawa 2005, Jator et al. 2012, and Ngwane et al. 2012b). In the spirit of 2005, the motivation governing the exponentially-fitted methods is inherent to the fact that if the frequency or a reasonable estimate of it is known in advance, these methods will be more advantageous than the polynomial based methods.

The aim of this paper is to construct a TSDM. This construction is done by initially developing a CTSDM which then provides a discrete method that is applied as a TSDM which takes the frequency of the solution as a priori knowledge. In particular, CTSDM consists of a sum of continuous functions while TSDM is a by-product of CTSDM. The coefficients of the TSDM are functions of the frequency and the stepsize, hence the solutions provided by the proposed method are highly accurate if (1) has periodic solutions with known frequencies. We adopt the approach given in Jator et al. in (Ngwane and Jator 2012a; Jator et al. 2012), where the TSDM is used to obtain the approximation *y*_{n+1} to the exact solution *y*(*x*_{n+1}) on the interval [ *x*_{
n
},*x*_{n+1}], *h*=*x*_{n+1}−*x*_{
n
}, *n*=0,…,*N*−1, on a partition [ *a*,*b*], where a,b\in \mathbb{R}, *h* is the constant stepsize, *n* is a grid index and *N*>0 is the number of steps. We note that second derivative methods with polynomial basis functions were proposed to overcome the Dahlquist 1956 barrier theorem whereby the conventional linear multistep method was modified by incorporating the second derivative term in the derivation process in order to increase the order of the method, while preserving good stability properties (see Enright 1974).

This paper is organized as follows. In Section “’’, we obtain a trigonometric basis representation *U*(*x*) for the exact solution *y*(*x*) which is used to generate a TSDM for solving (1). The analysis and implementation of the TSDM are discussed in Section “Error analysis and stability” to show the accuracy and efficiency of the TSDM. Finally, we give some concluding remarks in Section “Conclusion”.

## Development of method

In this section, our objective is to construct a CTSDM which produces a discrete method as a by-product. The method has the form

where *u*=*w* *h*, *β*_{
j
}(*u*), *γ*_{
j
}(*u*), *j*=0,1, are coefficients that depend on the stepsize and frequency. We note that *y*_{n+j} is the numerical approximation to the analytical solution *y*(*x*_{n+j}), and

with *j*=0,1. In order to obtain equation (2) we proceed by seeking to approximate the exact solution *y*(*x*) on the interval [ *x*_{
n
},*x*_{
n
}+*h*] by the interpolating function *U*(*x*) of the form

where *a*_{0},*a*_{1},*a*_{2},*a*_{3} and *a*_{4} are coefficients that must be uniquely determined. We then impose that the interpolating function in (3) coincides with the analytical solution at the point *x*_{
n
} to obtain the equation

We also demand that the function (3) satisfies the differential equation (1) at the points *x*_{n+j}, *j*=0,1 to obtain the following set of three equations:

Equations (4) and (5) lead to a system of five equations which is solved by Cramer’s rule to obtain *a*_{
j
}, *j*=0,1,2,3,4. Our continuous CTSDM is constructed by substituting the values of *a*_{
j
} into equation (3). After some algebraic manipulation, the CTSDM is expressed in the form

where *w* is the frequency, *β*_{0}(*w*,*x*), *β*_{1}(*w*,*x*), *γ*_{0}(*w*,*x*), and *γ*_{1}(*w*,*x*), are continuous coefficients. The continuous method (6) is used to generate the method of the form (2). Thus, evaluating (6) at *x*=*x*_{n+1} and letting *u*=*w* *h*, we obtain the coefficients of (2) as follows:

## Error analysis and stability

### Local truncation error

We note that when *u*→0 the coefficients given by (7) are vulnerable to heavy cancellations and hence the following Taylor series expansion must be used (see Simos 1998).

In fact, for practical computations when *u* is small, it is better to use the series expansion (8) (see Calvo et al. 2009).

Thus the Local Truncation Error (LTE) of (2) subject to (8) is obtained as

####
**Remark**
**1**

The method (2) specified by (8) is a fourth-order method and reduces to a one-step conventional second derivative method as *u*→0 (see Lambert 1973, p. 201).

### Stability

####
**Proposition**
**1**

The TSDM (2) applied to the test equations *y*^{′}=*λ* *y* and *y*^{′′}=*λ*^{2}*y* yields

with

#### Proof

We begin by applying (2) to the test equations *y*^{′}=*λ* *y* and *y*^{′′}=*λ*^{2}*y* which are expressed as *f*(*x*,*y*)=*λ* *y* and *g*(*x*,*y*)=*λ*^{2}*y* respectively; letting *q*=*h* *λ* and *u*=*w* *h*, we obtain a linear equation which is used to solve for *y*_{n+1} with (11) as a consequence.

####
**Remark**
**2**

The rational function *M*(*q*;*u*) is called the stability function which determines the stability of the method.

####
**Definition**
**1**

A region of stability is a region in the *q*−*u* plane, in which |*M*(*q*;*u*)|≤1.

The TSDM method (2) specified by (7) is given by

####
**Definition**
**2**

The method (12) is zero-stable provided the roots of the first characteristic polynomial have modulus less than or equal to unity and those of modulus unity are simple (see Lambert 1991).

####
**Definition**
**3**

The method (12) is consistent if it has order *p*>1 (see (Fatunla 1991)).

####
**Remark**
**3**

The TSDM (12) is consistent as it has order *p*>1 and zero-stable, hence it is convergent since zero-stability + consistency = convergence.

####
**Corollary**
**1**

The TSDM (12) has *M*(*q*;*u*) specified by

####
**Remark**
**4**

In the *q*−*u* plane the TSDM (12) is stable for *q*≤0, and *u*∈[ −2*π*,2*π*], since from above |*M*(*q*;*u*)|≤1, *q*≤0.

####
**Remark**
**5**

Figure 1 is a plot of the stability region and Figure 2 shows the zeros and poles of *M*(*q*;*u*). We note from Figure 2 that the stability region includes the entire left side of the complex plane.

####
**Definition**
**4**

The TSDM with the stability function (11) is said to be A-stable at *u*=*u*_{0}, −2*π*≤*u*_{0}≤2*π*, if |*M*(*q*;*u*)|≤1, \forall q\in {\mathbb{C}}^{-}, (see Nguyen et al. 2007).

####
**Remark**
**6**

We observe from definition 1, remarks 4, 5, and Figure 2, that TSDM is *A*-stable. In particular, |*M*(*q*;*i* *y*)|=1\forall y\in \mathbb{R}, and by the maximum principle, the method will be A-stable if |*M*(*q*;*u*)| has no poles in the left plane (see E. Hairer et al. 1996, p.43, 53). Moreover, the real part of the zeros of |*M*(*q*;*u*)| must be negative, while the real part of the poles of |*M*(*q*;*u*)| must be positive.

### Implementation

In the spirit of Ngwane et al. in (Ngwane and Jator 2012a; 2012b), the TSDM (12) is implemented to solve (1) without requiring starting values and predictors. For instance, if we let *n*=0 in (12), then *y*_{1} is obtained on the sub-interval [ *x*_{0},*x*_{1}], as *y*_{0} is known from the IVP. Similarly, if *n*=1, then *y*_{2} is obtained on the sub-interval [ *x*_{1},*x*_{2}], as *y*_{1} is known from the previous computation, and so on; until we reach the final sub-interval [ *x*_{N−1},*x*_{
N
}]. We note that for linear problems, we solve (1) directly using the feature *s* *o* *l* *v* *e*[ ] in Matlab, while nonlinear problems use the Newton’s method in Matlab enhanced by the feature *f* *s* *o* *l* *v* *e*[ ].

## Numerical examples

In this section, we give numerical examples to illustrate the accuracy (small errors) and efficiency (fewer number of function evaluations (NFEs)) of the TSDM. We find the approximate solution on the partition *π*_{
N
}, where *π*_{
N
}:*a*=*x*_{0}<*x*_{1}<*x*_{2}<...<*x*_{
n
}<*x*_{n+1}<…<*x*_{
N
}=*b*, and we give the errors at the endpoints calculated as Error= *y*_{
N
}−*y*(*x*_{
N
}). We note that the method requires only two function evaluations per step and in general requires (2*N*+2) NFEs on the entire interval. All computations were carried out using a written code in Matlab.

### Example 1

Consider the given two-body problem which was solved by Ozawa 2005.

where *e*, 0≤*e*<1 is an eccentricity. The exact solution of this problem is

where *k* is the solution of the Kepler’s equation *k*=*x*+*e* sin(*k*). We choose *ω*=1.

Table 1 contains the results obtained using the TSDM. These results are compared with the explicit singly diagonally implicit Runge-Kutta (ESDIRK) and the functionally fitted ESDIRK (FESDIRK) methods given in Ozawa 2005. In terms of accuracy, Table 1 clearly shows that TSDM performs better than those in Ozawa 2005.

### Example 2

We consider the nonlinear Duffing equation which was also solved Ixaru et al. 2004.

The analytic solution is given by

where *Ω*=1.01, *B*=0.002, *C*_{0}=0.200426728069, *C*_{1}=0.200179477536, *C*_{2}=0.246946143×10^{−3}, *C*_{3}=0.304016×10^{−6}, *C*_{4}=0.374×10^{−9}. We choose *ω*=1.01 and for more on frequency choice see Ramos et al. 2010.

We compare the end-point global errors for TSDM with the fourth order methods in Ixaru et al. 2004. We see from Table 2 that the results produced by TSDM are better than Simos’ method used in (Ixaru and Berghe 2004), as TSDM produces better error magnitude while using less number of steps and fewer number of function evaluations. TSDM is very competitive to the method used by Ixaru et al. 2004.

### Example 3

We consider the following inhomogeneous IVP by Simos 1998.

where the analytic solution is given by

The exponentially-fitted method in Simos 1998 is fourth order and hence comparable to our method, TSDM. We see from Table 3 that TSDM is more efficient than the method in Simos 1998. We also compare the computational efficiency of the two methods by considering the NFEs over *N* integration steps for each method. Our method, TSDM, requires only 2*N*+2 function evaluations in *N* steps compared to 4*N* function evaluations in *N* steps for the method in Simos 1998. Hence for this example, TSDM performs better.

### Example 4

*Linear Kramarz problem We consider the following second-order IVP, (see Nguyen et al.*
2007
*[p. 204])*

We use this example to show the efficiency of TSDM on linear systems. Nguyen et al.2007 used the “trigonometric implicit Runge-Kutta”, TIRK3, method to solve the above linear Kramarz problem. Clearly, TSDM performs better as seen in Table 4.

### Example 5

*We consider the IVP (see Vigo-Aguiar et al.*
2003
*)*

where *K*=314.16, and we choose *ω*=314.16. The analytic solution is given by

This problem demonstrates the performance of TSDM on a well-known oscillatory problem. We compare the results from TSDM with the Dissipative Chebyshev exponential-fitted methods, CHEBY24 and CHEBY1 used in Vigo-Aguiar et al.2003. We see that TSDM uses fewer number of function evaluations with better accuracy than CHEBY24 that is designed to use fewer number of steps. Integrating in the interval [ 0,1] with a stepsize equal to the total length of the interval, we obtain an error of order 10^{−21}. Hence TSDM is a more efficient integrator. We note that compared with the methods CHEBY24 and CHEBY1 which use stepsizes considerably larger than those used in multistep methods, TSDM is very competitive and superior to both CHEBY24 and CHEBY1.

### Example 6

A nearly sinusoidal problem

We consider the following IVP on the range 0≤*t*≤10, (see Nguyen et al.2007, p. 205)

We choose *β*=−3 and *β*=−1000 in order to illustrate the phenomenon of stiffness. Given the initial conditions *y*_{1}(0)=2 and *y*_{2}(0)=3, the exact solution is *β*-independent and is given by

This example is chosen to demonstrate the performance of TSDM on stiff problems. We compute the solutions to Example (6) with *β*=−3, −1000. We obtain better absolute errors than Nguyen et al. (2007). This efficiency is achieved using fewer number of steps and less number of function evaluations than Nguyen et al. (2007). For example when *β*=−3, our method generates a solution with error magnitude 10^{−6} involving just 6 steps and 28 function evaluations, whereas (Nguyen et al. 2007) attains the same error magnitude using 10 steps and 47 function evaluations. When *β*=−1000, TSDM generates solutions with comparable error magnitude. We see that TSDM is competitive and better than the method in Nguyen et al. (2007) which is of order six and is thus expected to do better.

### An implementation in predictor-corrector mode

In this section, we also implement our CTSDM in a predictor-corrector mode. The predictor is given by

where

and the corrector is given by equations (6) and (7). We note that when *u*→0 we use the following Taylor series expansion (see Simos1998)

As we expected, the predictor-corrector (PreCor) mode runs faster than the TSDM but is less accurate compared to the TSDM. We illustrate this by applying the predictor-corrector to Example 2 and Example 3. We plot the efficiency curves showing the accuracy versus the CPU computation time, and the accuracy versus the NFEs.

### Estimating the frequency

A preliminary testing indicates that a good estimate of the frequency can be obtained by demanding that *L* *T* *E*=0, and solving for the frequency. That is, solve for *ω* given that \left(-\frac{{h}^{5}}{720}\left({w}^{2}{y}^{\left(3\right)}\left({x}_{n}\right)+{y}^{\left(5\right)}\left({x}_{n}\right)\right)\right)=0, where *y*^{(j)},*j*=2,…,5 denote derivatives. We used this procedure to calculate *ω* for the problem given in example (5) and obtained *ω*≈± 314.16, which approximately gives the known frequency *ω*=314.16. Hence, this procedure is interesting and will be seriously considered in our future research.

We note that estimating the frequency and the choice of the frequency in trigonometrically-fitted methods is challenging and has grown in interest. Existing references on how to estimate the frequency and on the choice of the frequency include G. Vanden Berghe et al.2001b, and Ramos et al.2010.

## Conclusion

We have proposed a TSDM for solving oscillatory IVPs. The TSDM is *A*-stable and hence, an excellent candidate for solving stiff IVPs. This method has the advantages of being self-starting, having good accuracy with order 4, and requiring only two functions evaluation at each integration step. We have presented representative numerical examples that are linear, non-linear, stiff and highly oscillatory. These examples show that the TSDM is more accurate and efficient than those in Nguyen et al.2007, Simos1998, Ixaru et al.2004, and Ozawa2005. Details of the numerical results are displayed in Tables 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10 and the efficiency curves are presented in Figures 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12. Our future research will incorporate a technique for accurately estimating the frequency as suggested in subsection “Estimating the frequency” as well as implementing the method in a variable step mode.

## References

Calvo M, Franco J, Montijano J, Randez L: Sixth-order symmetric and symplectic exponentially fitted Runge-Kutta methods of the Gauss type.

*J Comput Appl Math*2009, 223: 387-398. 10.1016/j.cam.2008.01.026Dahlquist G:

*Numerical integration of ordinary differential equations*. 1956.Enright W: Second Derivative Multistep Methods for Stiff ordinary differential equations.

*SIAM J Numer Anal*1974, 11: 321-331. 10.1137/0711029Fang Y, Song Y, Wu X: A robust trigonometrically fitted embedded pair for perturbed oscillators.

*J Comput Appl Math*2009, 225: 347-355. 10.1016/j.cam.2008.07.053Fatunla S: Block methods for second order IVPs.

*Intern J Comput Math*1991, 41: 55-63. 10.1080/00207169108804026Franco J: Runge-Kutta-Nyström methods adapted to the numerical intergration of perturbed oscillators.

*Comput Phys Comm*2002, 147: 770-787. 10.1016/S0010-4655(02)00460-5Hairer E: A One-step Method of Order 10 for

*y*^{′′}=*f*(*x*,*y*).*IMA J Numer Anal*1982, 2: 83-94. 10.1093/imanum/2.1.83Hairer E, Wanner G:

*Solving Ordinary Differential Equations II*. Springer, New York; 1996.Kluwer, Dordrecht, Dordrecht, Kluwer (Eds):

*Exponential fitting*. Netherlands; 2004.Jator S, Swindle S, French R: Trigonometrically fitted block Numerov type method for

*y*^{′′}=*f*(*x*,*y*,*y*^{′}).*Numerical Algorithms*2012. doi:10.1007/s11075-012-9562-1Lambert J: Computational methods in ordinary differential equations. 1973.

Lambert J:

*Numerical methods for ordinary differential systems*. John Wiley, New York; 1991.Ngwane F, Jator S: Block hybrid-second derivative method for stiff systems.

*Intern J Pure Appl Math*2012a, 4: 543-559.Ngwane F, Jator S: Block hybrid method using trigonometric basis for initial value problems with oscillating solutions.

*Numerical Algorithms*2012b. doi:10.1007/s11075-012-9649-8Nguyen H, Sidje R, Cong N: Analysis of trigonometric implicit Runge-Kutta methods.

*J Comput Appl Math*2007, 198: 187-207. 10.1016/j.cam.2005.12.006Ozawa K: A functionally fitted three-stage explicit singly diagonally implicit Runge-Kutta method.

*Japan J Indust Appl Math*2005, 22: 403-427. 10.1007/BF03167492Ramos H, Vigo-Aguiar J: On the frequency choice in trigonometrically fitted methods.

*Appl Math Lett*2010, 23: 1378-1381. 10.1016/j.aml.2010.07.003Simos T: An exponentially-fitted Runge-Kutta method for the numerical integration of initial-value problems with periodic or oscillating solutions.

*Comput Phys Commun*1998, 115: 1-8. 10.1016/S0010-4655(98)00088-5Sommeijer B: Explicit high-order Runge-Kutta-Nyström methods for parallel computers.

*Appl Numer Math*1993, 13: 221-240. 10.1016/0168-9274(93)90145-HVanden Berghe G, Ixaru L, Van Daele M: Optimal implicit exponentially-fitted Runge-Kutta.

*Comput Phys Commun*2001a, 140: 346-357. 10.1016/S0010-4655(01)00279-XVanden Berghe G, Ixaru L, De Meyer H: Frequency determination and step-length control for exponentially-fitted RungeŰKutta methods.

*J Comput Appl Math*2001b, 132: 95-105. 10.1016/S0377-0427(00)00602-6Vanden Berghe G, Van Daele M: Exponentially-fitted Obrechkoff methods for second-order differential equations.

*Appl Numer Math*2009, 59: 815-829. 10.1016/j.apnum.2008.03.018Vigo-Aguiar J, Ramos H: Dissipative Chebyshev exponential-fitted methods for numerical solution of second-order differential equations.

*J. Comput Appl Math*2003, 158: 187-211. 10.1016/S0377-0427(03)00473-4

## Author information

### Authors and Affiliations

### Corresponding author

## Additional information

### Competing interests

The authors declare that they have no competing interests.

### Authors’ contributions

SJ proposed the algorithm. FN and SJ developed, analyzed and implemented the method. FN and SJ drafted the manuscripts. All authors read and approved the final manuscript.

## Authors’ original submitted files for images

Below are the links to the authors’ original submitted files for images.

## Rights and permissions

**Open Access** This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (https://creativecommons.org/licenses/by/4.0), which permits use, duplication, adaptation, distribution, and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

## About this article

### Cite this article

Ngwane, F.F., Jator, S.N. Trigonometrically-fitted second derivative method for oscillatory problems.
*SpringerPlus* **3**, 304 (2014). https://doi.org/10.1186/2193-1801-3-304

Received:

Accepted:

Published:

DOI: https://doi.org/10.1186/2193-1801-3-304