# Waves and Stability¶

MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
In [1]:
import numpy as np
import matplotlib.pyplot as plt


## Wavelength and Wavenumber¶

Let $j$ be the wave number, then $$j = \frac{2\pi}{\tilde{\lambda}}$$ where $\tilde{\lambda}$ is the wavelength.

A sinusoidal wave is expressed as $$A \cos \left( \frac{2 \pi x}{\tilde{\lambda}} \right).$$

In [2]:
kdx = np.linspace(0, np.pi, 20) / np.pi
plt.plot(kdx, np.cos(2*np.pi*kdx / 0.001))
plt.plot(kdx, np.cos(2*np.pi*kdx / 1.0))

Out[2]:
[<matplotlib.lines.Line2D at 0x7f981cb08050>]
In [3]:
def ampFTBS(jhx, lmbda):
return np.sqrt(1 - 2 * lmbda * (1 - lmbda) * (1 - np.cos(np.pi*jhx)))

def ampBTCS(jhx, lmbda):
return 1 / np.sqrt(1 + lmbda**2 * np.sin(np.pi * jhx)**2)

In [7]:
jhx = np.linspace(0, np.pi, 100) / np.pi

#lmbdas = [0.1, 0.2, 0.4, 0.8, 0.9, 1.0, 1.2, 1.4, 1.8, 2.0]
lmbdas = [0.1, 0.2, 0.5, 0.6, 0.75, 0.9, 1.1]

for lmbda in lmbdas:
plt.plot(jhx, ampFTBS(jhx, lmbda), label='%g'%lmbda, lw=4)

plt.legend()
plt.xlabel('$j h_x / \pi$', fontsize=24)
plt.ylabel('$|s(j)|$', fontsize=24)

Out[7]:
Text(0, 0.5, '$|s(j)|$')

## Dispersion¶

In [5]:
def alphaoverj(jhx, lmbda):
return np.arctan((lmbda * np.sin(np.pi*jhx)) / (1 - lmbda + lmbda*np.cos(np.pi*jhx))) / (lmbda * np.pi * jhx)

In [6]:
jhx = np.linspace(0, np.pi, 100) / np.pi

#lmbdas = [0.1, 0.2, 0.4, 0.8, 0.9, 1.0, 1.2, 1.4, 1.8, 2.0]
lmbdas = [0.25, .33, 0.88]

for lmbda in lmbdas:
plt.plot(jhx, alphaoverj(jhx, lmbda), label='%g' % lmbda)
plt.legend()
plt.xlabel('$j h_x / \pi$', fontsize=24)

/home/andreas/src/env-3.7/lib/python3.7/site-packages/ipykernel_launcher.py:2: RuntimeWarning: invalid value encountered in true_divide


Out[6]:
Text(0.5, 0, '$j h_x / \\pi$')