1 Introduction

Delays are inherent in many natural and physical processes, for example our ability to locate the direction of the sound source comes from the capacity of our ears to detect the small time lag (delay) between the sound perceived by our left and right ear [1]. In engineering, DDEs are used as mathematical models in analyzing manufacturing processes [2], real-time sub-structuring [3], and in control theory [4].

Stability analysis of DDEs is important, particularly to find parameters for which the physical process is stable or to estimate the largest delay that a system can tolerate to remain stable. In machine tool vibrations, for example, the tool dynamics are governed by DDEs [5] and with the help of stability analysis we can find machining parameters for decreased surface roughness.

DDEs are infinite dimensional systems, inasmuch as their characteristic equations have infinitely many roots. The Lambert W function [68], Laplace transforms [9], and D-subdivision methods [10] can be used to study stability of DDEs with single delay. Asymptotics can be used to calculate roots of scalar DDEs with few delays [11]. Lyapunov functions [1214] can also be used to determine the stability of DDEs. General methods for obtaining the stability of DDEs with multiple delays first convert the DDE into a partial differential equation (PDE) [1518] with a linear boundary condition. Then, ordinary differential equations (ODEs) based approximation for the PDE can be developed by using spatial discretization methods, such as:

  • Semi-discretization [19]

  • Spectral least squares [20]

  • Spectral tau methods [15, 21]

  • Pseudo-spectral collocation [2224]

  • Time finite elements [25, 26]

  • Continuous time approximation [27, 28]

  • Finite difference methods [17, 29]

As we represent a DDE using a PDE with a linear boundary condition, the way in which we incorporate the boundary condition while developing the ODE approximations will influence the spectrum (roots of the characteristic equation of the DDE). For example the boundary condition can be incorporated using spectral-tau method [15, 21], or by spectral-least squares [20] method.

In this paper we compare the spectral-tau and spectral-least squares approaches for obtaining the characteristic roots of DDEs. Spectral methods are advantageous due to their exponential convergence rates [30] to the actual solution. Previously, within the frame work of spectral (Galerkin) methods, only mixed Fourier basis was used for obtaining characteristic roots or solution of the DDEs [20, 21]. The convergence characteristics of the mixed Fourier basis have not been explored in detail, for example in [21] for a test problem (see Table 1) only one root converges to a tolerance of two decimal places when using mixed Fourier basis in the Galerkin solution. In this paper we study the influence of the choice of spectral basis, i.e, shifted Chebyshev, shifted Legendre, and mixed Fourier basis on the convergence of the characteristic roots for some example problems.

Table 1 Percentage of number of converged roots for different methods and for different basis functions

2 Recasting and solving a delay equation as an advection equation

For clarity of presentation we only consider a scalar DDE in this work. The theory developed in this paper can be easily extended to higher order DDEs following the work of Vyasarayani [20]. We consider the scalar delay equation with \(m\) delays

$$\begin{aligned} \dot{x}(t)+ax(t)+\sum \limits _{q=1}^{m}b_{q}x(t-\tau _{q})=0,\quad \tau _{q}>0. \end{aligned}$$
(1)

The initial function is specified as

$$\begin{aligned} x(t)=\theta (t),\,-\tau \le t\le 0, \end{aligned}$$
(2)

where \(\tau =\mathrm {max}(\tau _{1},\,\tau _{2},\ldots ,\tau _{m})\). By introducing the so-called shift of time \(y(s,t)=x(t+s),\,s\in \left[ -\tau ,0\right) \), the initial value problem (Eqs. (1), (2)) can be recast into the following initial-boundary value problem for the advection Eqs. [16, 17]

$$\begin{aligned}&\frac{\partial y(s,t)}{\partial t}=\frac{\partial y(s,t)}{\partial s},\qquad s\in \left[ -\tau ,0\right] ,\end{aligned}$$
(3)
$$\begin{aligned}&\left. \frac{\partial y(s,t)}{\partial t}\right| _{s=0}=-ay(0,t)-\sum _{q=1}^{m}b_{q}y(-\tau _{q},t), \end{aligned}$$
(4)
$$\begin{aligned}&y(s,0)=\theta (s),\quad s\in \left[ -\tau ,0\right] . \end{aligned}$$
(5)

We discuss two methods, the spectral-tau method and spectral-least squares method for the approximate solution of Eqs. (35).

2.1 Spectral-tau method

In the spectral-tau method we assume a solution to the PDE (Eq. 3) of the following form:

$$\begin{aligned} y(s,t)=\sum _{i=1}^{\infty }\phi _{i}(s)\eta _{i}(t), \end{aligned}$$
(6)

where \(\phi _{i}(s)\) are the basis functions and \(\eta _{i}(t)\) are the time dependent coordinates. For practical reasons the sum is terminated at \(N\) terms, i.e.

$$\begin{aligned} y(s,t)={\varvec{\phi }}(s)^{T}{\varvec{\eta }}(t), \end{aligned}$$
(7)

where \({\varvec{\phi }}(s)=[\phi _{1}(s),\,\phi _{2}(s),\,\ldots ,\phi _{N}(s)]^{T}\) and \({\varvec{\eta }}(t)=[\eta _{1}(t),\,\eta _{2}(t),\,\ldots ,\eta _{N}(t)]^{T}\). Substituting the series solution Eq. (7) in Eq. (3) we get (the symbol \(^{^{\prime }}\) denotes derivative with respect to \(s\))

$$\begin{aligned} {\varvec{\phi }}(s)^{T}\dot{{\varvec{\eta }}}(t)= {\varvec{\phi }}^{^{\prime }}(s)^{T}{\varvec{\eta }}(t). \end{aligned}$$
(8)

Pre-multipling Eq. (8) with \({\varvec{\phi }}(s)\) and integrating over the domain we get:

$$\begin{aligned} \int \limits _{-\tau }^{0}{\varvec{\phi }}(s){\varvec{\phi }}(s)^{T}ds\dot{{\varvec{\eta }}}(t)=\int \limits _{-\tau }^{0}{\varvec{\phi }}(s) {\varvec{\phi }}^{^{\prime }}(s)^{T}ds{\varvec{\eta }}(t). \end{aligned}$$
(9)

In matrix form

$$\begin{aligned} \mathbf {A}\dot{{\varvec{\eta }}}(t)=\mathbf {B}{\varvec{\eta }}(t), \end{aligned}$$
(10)

with

$$\begin{aligned} \mathbf {A}&= \int \limits _{-\tau }^{0}{\varvec{\phi }}(s){\varvec{\phi }} (s)^{T}ds,\end{aligned}$$
(11)
$$\begin{aligned} \mathbf {B}&= \int \limits _{-\tau }^{0}{\varvec{\phi }}(s) {\varvec{\phi }}^{^{\prime }}(s)^{T}ds. \end{aligned}$$
(12)

Substituting Eq. (7) in Eq. (4) we get the scalar equation

$$\begin{aligned} {\varvec{\phi }}(0)^{T}\dot{{\varvec{\eta }}}(t)=\left[ -a\varvec{\phi }(0)^{T}-\sum _{q=1}^{m}b_{q} {\varvec{\phi }}(-\tau _{q})^{T}\right] {\varvec{\eta }}(t). \end{aligned}$$
(13)

Note that (10, 13) provide \(N+1\) independent equations. To arrive at a determinate system we truncate the system (10) and augment it with (13) to form

$$\begin{aligned} \mathbf {M}_{Tau}\dot{{\varvec{\eta }}}(t)=\mathbf {K}_{Tau}{\varvec{\eta }}(t), \end{aligned}$$
(14)

where

$$\begin{aligned} \mathbf {M}_{Tau}&= \left[ \begin{array} [c]{c} \bar{\mathbf{A}}\\ {\varvec{\phi }}(0)^{T} \end{array} \right] ,\end{aligned}$$
(15)
$$\begin{aligned} \mathbf {K}_{Tau}&= \left[ \begin{array} [c]{c} \bar{\mathbf{B}}\\ -a{\varvec{\phi }}(0)^{T}-\sum _{q=1}^{m}b_{q}\phi (-\tau _{q})^{T} \end{array} \right] , \end{aligned}$$
(16)

and matrices \(\bar{\mathbf{A}},\,\bar{\mathbf{B}}\) are obtained by deleting the last row of matrix \(\mathbf {A}\) and \(\mathbf {B}\), respectively. The initial conditions for Eq. (14) is \({\varvec{\eta }} (0)=\mathbf {M}^{-1}\int \limits _{-\tau }^{0}{\varvec{\phi }}(s)\theta (s)ds\) and the solution of the DDE can be obtained as \(x(t)=y(0,t)={\varvec{\phi }} (0)^{T}{\varvec{\eta }}(t)\). The finite dimensional system (14) represents an approximation for Eq. (1).

2.2 Spectral least-squares method

The error in the PDE (3) due to the substitution of the truncated approximate solution \(y(s,t)=\sum _{i=1}^{N}\phi _{i} (s)\eta _{i}(t)\) is

$$\begin{aligned} e(s,t)={\varvec{\phi }}(s)^{T}\dot{{\varvec{\eta }}}(t)-\varvec{\phi }^{^{\prime }}(s)^{T}{\varvec{\eta }}(t). \end{aligned}$$
(17)

A good approximation is characterized by a “small” error \(e(s,t)\) subject to the boundary constraint Eq. (13). To minimize the error, we aim to solve the following constrained optimization problem:

$$\begin{aligned}&\underset{\dot{{\varvec{\eta }}}(t)}{\min }\frac{1}{2}\int \limits _{-\tau } ^{0}e(s,t)^{2}ds\nonumber \\&\quad = \underset{\dot{{\varvec{\eta }}}(t)}{\min }\frac{1}{2}\int \limits _{-\tau }^{0}\left[ {\varvec{\phi }}(s)^{T}\dot{{\varvec{\eta }} }(t)-{\varvec{\phi }}^{^{\prime }}(s)^{T}{\varvec{\eta }}(t)\right] ^{2}ds \end{aligned}$$
(18)
$$\begin{aligned}&\mathrm {s.t.}\,\,{\varvec{\phi }}(0)^{T}\dot{{\varvec{\eta }}}(t)=\left[ -a{\varvec{\phi }}(0)^{T}-\sum _{q=1}^{m}b_{q}{\varvec{\phi }}(-\tau _{q} )^{T}\right] {\varvec{\eta }}(t),\nonumber \\ \end{aligned}$$
(19)

i.e. we are interested to find \(\dot{{\varvec{\eta }}}(t)\) such that the integral of the square of the error function over the domain is minimized. We introduce a Lagrange multiplier \(\Lambda \) and construct the following Lagrangian

$$\begin{aligned} L(\dot{{\varvec{\eta }}}(t),\Lambda )&= \frac{1}{2}\int \limits _{-\tau }^{0}\left[ {\varvec{\phi }}(s)^{T}\dot{{\varvec{\eta }}}(t)-{\varvec{\phi }} ^{^{\prime }}(s)^{T}{\varvec{\eta }}(t)\right] ^{2}ds \nonumber \\&-\Lambda \left[ {\varvec{\phi }}(0)^{T}\dot{{\varvec{\eta }} }(t)+a{\varvec{\phi }}(0)^{T}{\varvec{\eta }}(t) \right. \nonumber \\&\left. +\sum _{q=1}^{m} b_{q}{\varvec{\phi }}(-\tau _{q})^{T}{\varvec{\eta }}(t)\right] . \end{aligned}$$
(20)

We seek to minimize \(L(\dot{{\varvec{\eta }}}(t),\Lambda )\). The first order optimality conditions for the minimization of \(L\) are [31]

$$\begin{aligned}&\frac{\partial L}{\partial \dot{{\varvec{\eta }}}(t)} = 0,\end{aligned}$$
(21)
$$\begin{aligned}&\frac{\partial L}{\partial \Lambda } = 0. \end{aligned}$$
(22)

Substituting Eq. (20) in Eqs. (21) and (22) we get:

$$\begin{aligned}&\mathbf {A}\dot{{\varvec{\eta }}}(t) = \mathbf {B}\varvec{\eta }(t)+{\varvec{\phi }}(0)\Lambda ,\end{aligned}$$
(23)
$$\begin{aligned}&{\varvec{\phi }}(0)^{T}\dot{{\varvec{\eta }}}(t) =-a\varvec{\phi }(0)^{T}{\varvec{\eta }}(t)- \sum _{q=1}^{m}b_{q}{\varvec{\phi }}(-\tau _{q})^{T}{\varvec{\eta }}(t), \end{aligned}$$
(24)

where \(\mathbf {A}\) and \(\mathbf {B}\) are the basis-dependent matrices defined in Eqs. (11) and (12) respectively.

Solving Eqs. (23) and (24) for the Lagrange multiplier yields

$$\begin{aligned} \Lambda&= -\frac{{\varvec{\phi }}(0)^{T}\mathbf {A}^{-1}\mathbf {B} }{{\varvec{\phi }}(0)^{T}\mathbf {A}{\varvec{\phi }}(0)}\varvec{\eta }(t)\nonumber \\&-\frac{1}{{\varvec{\phi }}(0)^{T}\mathbf {A}^{-1}{\varvec{\phi }} (0)}\left( a{\varvec{\phi }}(0)^{T}+\sum _{q=1}^{m}b_{q}\varvec{\phi }(-\tau _{q})^{T}\right) {\varvec{\eta }}(t). \nonumber \\ \end{aligned}$$
(25)

Substituting the value of \(\Lambda \) in Eq. (23) and simplifying we get:

$$\begin{aligned} \mathbf {A}\dot{{\varvec{\eta }}}(t)= \mathbf {K}_{LS}{\varvec{\eta }}(t), \end{aligned}$$
(26)

where

$$\begin{aligned} \mathbf {K}_{LS}&= \mathbf {B}- \frac{1}{{\varvec{\phi }}(0)^{T}\mathbf {A}{} ^{-1}{\varvec{\phi }}(0)}\left( {\varvec{\phi }}(0){\varvec{\phi }} (0)^{T}\mathbf {A}^{-1}\mathbf {B}\right. \nonumber \\&\left. +\,a{\varvec{\phi }}(0){\varvec{\phi }} (0)^{T}+\sum _{q=1}^{m}b_{q}{\varvec{\phi }}(0){\varvec{\phi }}(-\tau _{q})^{T}\right) . \end{aligned}$$
(27)

Equation (26) represents the ODE approximation of the DDE Eq. (1).

3 Computing spectra

Substituting \(x(t)=ce^{\lambda t}\) in Eq. (1) we obtain the characteristic equation (\(\mathcal {C}\left( \lambda \right) \) is the characteristic function)

$$\begin{aligned} \mathcal {C}\left( \lambda \right) =\lambda +a+\sum _{q=1}^{m}b_{q} e^{-\lambda \tau _{q}}=0. \end{aligned}$$
(28)

A complex root \(\lambda \) of the characteristic equation (eigenvalue of Eq. 1) is written as

$$\begin{aligned} \lambda =\alpha +i\beta . \end{aligned}$$
(29)

Using Euler’s identity in (28) and separating the real and imaginary parts yields

$$\begin{aligned}&\alpha +a+\sum _{q=1}^{m}b_{q}e^{-\alpha \tau _{q}} \cos (\beta \tau _{q})=0,\end{aligned}$$
(30)
$$\begin{aligned}&\beta -\sum _{q=1}^{m}b_{q}e^{-\alpha \tau _{q}}\sin (\beta \tau _{q})=0. \end{aligned}$$
(31)

Equations (30, 31) are transcendental (exponential quasipolynomials) and have infinitely many roots. We define the spectrum of (1) as the set of roots of the characteristic equation, i.e.

$$\begin{aligned} S=\left\{ \lambda _{i}\,|\,\mathcal {C}\left( \lambda _{i}\right) =0,\,\mathrm {\mathrm{Re }}\lambda _{1}\ge \mathrm {\mathrm{Re } }\lambda _{2}\ge ..\right\} . \end{aligned}$$
(32)

The approximate spectrum obtained by calculating the eigenvalues of the \(N\times N\) system Eq. (14) is defined as

$$\begin{aligned} \hat{S}_{Tau}&= \left\{ \hat{\lambda }_{i}\,|\,\det \left( \mathbf {M}_{Tau} \hat{\lambda }_{i}-\mathbf {K}_{Tau}\right) =0,\right. \nonumber \\&\left. \mathrm {\mathrm{Re }} \hat{\lambda }_{1}\ge \mathrm {\mathrm{Re }}\hat{\lambda }_{2} \ge ..\right\} , \end{aligned}$$
(33)

and for Eq. (26) as

$$\begin{aligned} \hat{S}_{LS}=\left\{ \hat{\lambda }_{i}\,|\,\det \left( \mathbf {A}\hat{\lambda }_{i}-\mathbf {K}_{LS}\right) =0,\,\mathrm {\mathrm{Re }} \hat{\lambda }_{1}\ge \mathrm {\mathrm{Re }}\hat{\lambda }_{2} \ge ..\right\} . \end{aligned}$$
(34)

The error in the \(k\)-th eigenvalue is defined as

$$\begin{aligned} \varepsilon _{k}=\left| \mathcal {C}\left( \hat{\lambda }_{k}\right) \right| . \end{aligned}$$
(35)

The accuracy of the rightmost \(R\) roots of the approximate spectrum \(\hat{S}\) is characterized by the“tolerance”

$$\begin{aligned} T\left( R\right) =\max _{1\le k\le R}\varepsilon _{k}. \end{aligned}$$
(36)

We expect the choice of basis functions \({\varvec{\phi }}(s)\) in Eq. (7) to play an important role in the convergence of the eigenvalues. To test this hypothesis we consider three different basis functions: mixed Fourier basis [21]

$$\begin{aligned} {\varvec{\phi }}(s)=\left[ 1,\,s,\,\sin \left( \frac{\pi }{\tau }s\right) , \sin \left( 2\frac{\pi }{\tau }s\right) \ldots \right] ^{T}, \end{aligned}$$
(37)

shifted Legendre polynomials [30]

$$\begin{aligned} \phi _{1}\left( s\right)&= 1,\phi _{2}\left( s\right) =1+\frac{2s}{\tau },\nonumber \\ \phi _{i}\left( s\right)&= \frac{\left( 2i-3\right) \phi _{2}\left( s\right) \phi _{i-1}\left( s\right) -\left( i-2\right) \phi _{i-2}\left( s\right) }{\nonumber }\\&{i-1},i=3,\ldots , \end{aligned}$$
(38)

and shifted Chebyshev polynomials [30]

$$\begin{aligned} \phi _{1}\left( s\right)&= 1,\phi _{2}\left( s\right) =1+\frac{2s}{\tau },\nonumber \\ \phi _{i}\left( s\right)&= 2\phi _{2}\left( s\right) \phi _{i-1}\left( s\right) -\phi _{i-2}\left( s\right) ,i=3,\ldots \end{aligned}$$
(39)

4 Results

Here we compare the spectral tau and spectral least squares methods introduced in Sects. 2.1 and 2.2 on equations containing one, two, and (for a good measure) 30 delays. We use mixed Fourier (Eq. 37), Legendre (Eq. 38), and Chebyshev (Eq. 39) basis functions to study convergence properties of the two methods.

We first consider the equation with one time delay

$$\begin{aligned} \dot{x}+b_{1}x(t-\tau _{1})=0. \end{aligned}$$
(40)

It is an important case, since the eigenvalues of its characteristic equation

$$\begin{aligned} \lambda +b_{1}e^{-\lambda \tau _{1}}=0 \end{aligned}$$
(41)

can be obtained in closed form in terms of Lambert W function [6] as

$$\begin{aligned} \lambda _{r}=\frac{1}{\tau _{1}}W_{r}(-b_{1}\tau _{1}),\,\,r=-\infty ,\ldots ,-1,0,1,\ldots \infty . \end{aligned}$$
(42)

Here \(W_{k}\) corresponds to \(k{\text {th}}\) branch of the Lambert W function.

Figure 1 shows the number of converged roots for tolerance \(T\left( R\right) =10^{-4}\) for increasing \(N\) (number of terms used in the series solution (Eq. 7). Here \(R\) stands for the number of roots that have converged within a tolerance of \(10^{-4}\) (up to four decimal places). As expected, increasing the number of terms in the series solution will yield more and more eigenvalues. For example, with \(N~=~100\), 44 roots converge within a tolerance of \(10^{-4}\) for Legendre least square and Chebyshev least square method. However, with Fourier least square method only 2 roots converged. In spectral tau method for \(N~=~100\), 50 roots converged with Legendre basis and 46 roots converges with Chebyshev basis and only 2 roots converges with mixed Fourier basis. It is surprising to see the poor performance of the mixed Fourier basis for both the tau and the least squares method. Figure 2a–c show spectra of Eq. (41) obtained through Eq. (42) for the case \(b_{1}~=~\tau _{1}~=~1\) (other parameter values yield similar results). Superimposed on the graph are the roots obtained by the Legendre tau method for \(N~=~25\) (Fig. 2a), \(N=50\) (Fig. 2b), and \(N~=~100\) (Fig. 2c). We again see that for increasing \(N\) more and more eigenvalues of the approximate spectrum \(\hat{S}\) (Eq. 33) converge to the exact eigenvalues.

Fig. 1
figure 1

Number of converged roots for tolerance \(T\left( R\right) ~=~10^{-4}\) for increasing \(N\!:\) a spectral least squares method and b spectral tau method. The parameters are \(\tau _{1}~=~1\) and \(b_{1}~=~1\). The y-axis shows the number of roots \((R)\) that has converged within a tolerance of \(10^{-4}\). The x-axis shows the number of terms used in the series solution (Eq. 7) for obtaining the roots

Fig. 2
figure 2

Comparison of exact roots obtained with Lambert W function with approximate roots obtained from Legendre tau method for a \(N~=~25\), b \(N~=~50\) and c \(N~=~100\). The parameters are \(\tau _{1}~=~1\) and \(b_{1}~=~1\)

After having established the positive influence of increasing \(N\) on convergence, we used \(N~=~25\) to obtain the rest of the results.

Figure 3 shows the average error in each eigenvalue \(\varepsilon _{k}\) (see Eq. 35) for 1,000 simulations for spectral tau method and for spectral least squares method. The delay \(\tau _{1}\) and \(b_{1}\) were randomly selected from uniform distributions between \(\tau _{1}\in [0.1,\,1]\) and \(b_{1}\in [-10,\,10]\) respectively. We can observe from Fig. 3 that on an average for a tolerance \(10^{-10}\), 6 roots converged with Legendre tau method, 5 roots converged with chebyshev tau method, 4 roots with Legendre least square method, 3 roots with Chebyshev least square method and no roots converged with Fourier tau or Fourier least square method. We see from Fig. 3 that the Legendre tau method has the best performance in terms of number of converged roots.

Fig. 3
figure 3

Average error in the roots for spectral least squares and spectral tau methods with \(N~=~25\). The results are generated using 1,000 Monte Carlo simulations with \(b_{1}\) and \(\tau _{1}\) selected from a uniform distribution on \([0.1,\,1]\) and \([-10,\,10]\), respectively

We also studied the total number of roots \(R\) that converge to the required tolerance of \(10^{-4}\). To cover a large number of test cases, 10,000 simulations were performed with randomly selected parameters from uniform distributions for a two-delay equation (\(a\in [-10,\,10],\,b_{1}\in [-10,\,30],\,b_{2}\in [-10,\,50],\,\tau _{1}\in [0.1,\,5.1]\), and \(\tau _{2}\in [0.1,\,10.1]\)) and the equation with 30 delays (\(a\in [-10,\,10],\,\tau _{k}\in [0.1,\,10.1],\,b_{k}\in [-10,\,50],\,k=1,2,..,30\)). The results are summarized in Table 1 and Table 2. In the table each entry corresponds to the percentage of times the particular root has converged within a tolerance of \(10^{-4}\). For example for Fourier least square method (Table 1), no root converged for \(92~\%\) of cases and one root converged for \(8~\%\) of total cases.

Table 2 Percentage of number of converged roots for different methods and for different basis functions

It is clear that the choice of the mixed Fourier basis has an adverse effect on the number of eigenvalues found. We also note that the expected number of “correct” eigenvalues in the 30-delay case is smaller than that of the two-delay case, but this might be due to the different range of parameters selected for the simulations.

5 Discussion and conclusions

It is worth investigating why the mixed Fourier basis performs badly in terms of convergence compared to shifted Legendre and shifted Chebyshev basis (see Fig. 3). In the mixed Fourier basis, we have \({\varvec{\phi }}(s)=[1,\,s,\,\sin (\pi s/\tau ),\ldots ,\sin ((N-2)\pi s/\tau )]^{T}\) and we can see that only the first two terms have non-zero values at \(s~=~-\tau \) and for \(s~=~0\) only one term remains. The information about the rightmost delay appears in the spectral matrices \(\mathbf {M}_{Tau},\,\mathbf {K}_{Tau}\) and \(\mathbf {K}_{LS}\) through a term like \(\varvec{\phi }(-\tau )^{T}{\varvec{\eta }}(t)\), so the coupling terms for the largest delay are not strong (as most of the terms in \({\varvec{\phi }}(s)^{T}\) are zeros). This is not the case with the Legendre and Chebysev bases, where \({\varvec{\phi }}(s)^{T}\) is fully populated. We thus conjecture that the sparse nature of \({\varvec{\phi }}(s)^{T}\) at \(s~=~0\) and \(s~=~-\tau \) is a (if not the) reason for the bad convergence (see Fig. 3) behavior for the mixed Fourier basis.

We have studied the spectral-tau method and spectral-least squares method for obtaining characteristic roots of a linear DDE. We found that the spectral tau method performed better in terms of number of converged roots for given \(N\) (see Fig. 3; Tables 1, 2) than the spectral least squares method. Also the Legendre or Chebyshev basis performed much better (see Fig. 3; Tables 1, 2) in terms of error convergence compared to mixed Fourier basis. The spectral-tau method is easy to code and understand, also it performs better than the spectral-least squares method, so we recommend spectral-tau method for analyzing the stability of linear DDEs.