# Limitations of the Numerical Method¶

The numerical method used both in the stretched string problem and in GYRE generally performs very well; however, it has a couple of failure scenarios that are important to understand. These scenarios arise through poor choices of the spatial grid used to discretize the governing differential equation(s), and/or the frequency grid used to search for roots of the discriminant function.

## Insufficient Spatial Resolution¶

The cost of evaluating the determinant of the system matrix $$\mS$$ scales proportionally to the number of grid points $$N$$ used for the discretization. Therefore, in the interests of computational efficiency, we want to make $$N$$ as small as possible.

However, things go wrong when $$N$$ becomes too small. Fig. 4 demonstrates this by plotting the discriminant function for the stretched-string BVP with $$N=7$$. Compared against Fig. 1, we see that toward larger $$\sigma$$ the roots of the discriminant function become progressively shifted toward lower frequencies; and, above $$\sigma \approx 3.5 \pi c/L$$, they disappear altogether.

Fig. 4 Plot of the discriminant function $$\Dfunc(\sigma)$$ as a function of the frequency $$\sigma$$, for the stretched-string BVP with $$N=7$$. The orange dots highlight where $$\Dfunc=0$$. The function has been scaled so that $$\Dfunc(0) = 1$$. (Source)

To understand this behavior, recall that the determinant of an $$N \times N$$ matrix can be expressed (via Laplace expansion) as the sum of N terms; and each term itself involves the product of $$N$$ matrix elements, picked so that each row/column is used only once in the construction of the term. With these points in mind, we can see from the definition (4) of $$\mS$$ that its determinant (i.e., the discriminant function) must be a polynomial in $$\sigma^{2}$$ of order $$N-2$$; and as such, it can have at most $$N-2$$ (in this case, 5) roots. This leads us to important lesson #1:

Attention

The number of points adopted in the discretization limits the number of modes that can be found. With a spatial grid of $$N$$ points, there are only (of order) $$N$$ distinct numerical solutions.

Fig. 5 Plot of the eigenfunctions $$\tilde{y}$$ as a function of spatial coordinate $$x$$, for the first three modes of the stretched-string BVP with $$N=7$$. The discrete points show the numerical functions, and the solid lines the corresponding analytic functions. (Source)

Returning to Fig. 4, the shift in eigenfrequency for the modes that are found occurs due to inadequate resolution of the eigenfunctions. We can see this in Fig. 5, which reprises Fig. 3 for $$N=7$$. Clearly, the spatial oscillations of the modes are poorly resolved; the $$n=3$$ mode, for instance, is sampled with only one point per quarter wavelength. It’s little wonder that the corresponding eigenfrequencies are off. This brings us to important lesson #2 (closely related to #1):

Attention

The spatial resolution adopted in the discretization determines the accuracy of the modes found. A given eigenfrequency will be accurate only when the grid spacing is appreciably smaller than the spatial variation scale of its corresponding eigenfunction.

## Insufficient Frequency Resolution¶

When searching for root brackets, we have to evaluate the discriminant function a total of $$M$$ times. Therefore, as with the spatial grid, computational efficiency dictates that we want to make $$M$$ as small as possible. Again, however, things go wrong if $$M$$ is too small. Fig. 6 reprises Fig. 2, but adopting a much coarser frequency grid with only $$M=4$$ points.

Fig. 6 Plot of the discriminant values $$\{\Dfunc\}$$ on the discrete frequency grid $$\{\sigma\}$$, for the stretched-string BVP with $$N=50$$ and $$M=4$$. The orange halos indicate adjacent points that bracket a root $$\Dfunc=0$$. (Source)

Clearly, only the lowest-frequency ($$n=1$$) mode is found in the bracketing process; the rest are missed. This is admittedly an extreme example, but nicely demonstrates the consequences of too coarse a frequency grid, and gives us important lesson #3:

Attention

The frequency resolution adopted in the root bracketing influences the completeness of the modes found. All modes will be found only when the grid spacing is smaller than the eigenfrequency separation of adjacent modes.