# 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. 8 demonstrates this by plotting the discriminant function for the stretched-string BVP with $$N=7$$. Compared against Fig. 5, 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. 8 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. 9 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. 8, the shift in eigenfrequency for the modes that are found occurs due to inadequate resolution of the eigenfunctions. We can see this in Fig. 9, which reprises Fig. 7 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. 10 reprises Fig. 6, but adopting a much coarser frequency grid with only $$M=5$$ points. Fig. 10 Plot of the discriminant values $$\{\Dfunc\}$$ on the discrete frequency grid $$\{\sigma\}$$ (distributed uniformly in $$\sigma$$), for the stretched-string BVP with $$N=50$$ and $$M=5$$. The orange-haloed segments highlight adjacent points that bracket a root $$\Dfunc=0$$. (Source)

Clearly, a pair of adjacent roots (corresponding to the $$n=3$$ and $$n=4$$ modes) is missed in the bracketing process, as a direct result of the too-coarse grid.

Even when many points are included in the frequency grid, issues can still arise when the distribution of points doesn’t match the distribution of roots. An example of this is provided in Fig. 11, which reprises Fig. 6 with the same number $$M=32$$ of points in the grid, but now distributed uniformly in $$\sigma^{-1}$$. Fig. 11 Plot of the discriminant values $$\{\Dfunc\}$$ on the discrete frequency grid $$\{\sigma\}$$ (distributed uniformly in $$\sigma^{-1}$$), for the stretched-string BVP with $$N=50$$ and $$M=32$$. The orange-haloed segments highlight adjacent points that bracket a root $$\Dfunc=0$$. (Source)

Now it’s the roots corresponding to the $$n=4$$ and $$n=5$$ mode pair that are missed. As with the case in Fig. 10, the failure ultimately arises because the spacing between adjacent frequency grid points is (in at least some parts of the grid) larger than the spacing between adjacent roots. This can be summarized in 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, across the full range of the grid.