The Bessel function $J_2(x)$¶

In this notebook (which covers roughly the same ground as this video) we investigate the Bessel function $J_2(x)$. This is a special function like the trigonometric functions and exponentials, but not quite as well known. Bessel functions have many applications in situations with circular symmetry, such as vibrations of a circular drum, or flow of fluids in a cylindrical pipe.

We can calculate $J_2(x)$ in Python by importing the scipy library; it is then available as scipy.special.jv(2, x). We define J2 as a shorter name for this.

In [3]:
import scipy
import numpy as np
import matplotlib.pyplot as plt

def J2(x):
    return scipy.special.jv(2, x)

We can get an idea of the general shape by plotting $J_2(x)$ for $-50\leq x\leq 50$.

In [7]:
fig, ax = plt.subplots()
fig.set_size_inches(10, 5)
ax.spines['bottom'].set_position('zero')
xs = np.linspace(-50, 50, 1001)
ys = J2(xs)
ax.plot(xs, ys, 'r')
Out[7]:
[<matplotlib.lines.Line2D at 0x133b8a32a90>]
No description has been provided for this image

The plot below shows that $J_2(x)$ is very close to $x^2/8$ when $x$ is small.

In [8]:
fig, ax = plt.subplots()
fig.set_size_inches(10, 5)
ax.spines['bottom'].set_position('zero')
xs = np.linspace(-0.6, 0.6, 101)
ys = J2(xs)
ax.plot(xs, ys, 'r', label = r'$J_2(x)$')
ax.plot(xs, (xs ** 2)/8, 'b', label = r'$x^2/8$')
ax.legend()
Out[8]:
<matplotlib.legend.Legend at 0x133b8a98850>
No description has been provided for this image

The plot below shows that the envelope of $J_2(x)$ is $4x^{-1/2}/5$, so $J_2(x)$ oscillates between $-4x^{-1/2}/5$ and $+4x^{-1/2}/5$.

In [15]:
fig, ax = plt.subplots()
fig.set_size_inches(10, 5)
ax.spines['bottom'].set_position('zero')
xs = np.linspace(10, 300, 2000)
ys = J2(xs)
zs = 0.8 * xs ** -0.5
ax.plot(xs, ys, 'r', label = r'$J_2(x)$')
ax.plot(xs, zs, 'b', label = r'$4 x^{-1/2}/5$')
ax.plot(xs,-zs, 'g', label = r'$-4 x^{-1/2}/5$')
ax.legend()
Out[15]:
<matplotlib.legend.Legend at 0x133bb1e9dd0>
No description has been provided for this image

The plot below shows that $J_2(x)$ oscillates with a pattern very similar to that of $\sin(x+\pi/4)$.

In [10]:
fig, ax = plt.subplots()
fig.set_size_inches(10, 5)
ax.spines['bottom'].set_position('zero')
xs = np.linspace(10, 100, 1000)
ys = J2(xs)
zs = np.sin(xs + np.pi/4)
ax.plot(xs, ys, 'r', label = r'$J_2(x)$')
ax.plot(xs, zs, 'b', label = r'$\sin(x+\pi/4)$')
ax.legend()
Out[10]:
<matplotlib.legend.Legend at 0x133ba08f3d0>
No description has been provided for this image

The plot below shows that $J_2(x)$ is very close to $-4x^{-1/2}\sin(x+\pi/4)/5$ as soon as $x$ is reasonably large.

In [13]:
fig, ax = plt.subplots()
fig.set_size_inches(10, 5)
ax.spines['bottom'].set_position('zero')
xs = np.linspace(1, 50, 1000)
ys = J2(xs)
zs = -4/5 * xs ** -0.5 * np.sin(xs + np.pi/4)
ax.plot(xs, ys, 'r', label = r'$J_2(x)$')
ax.plot(xs, zs, 'b', label = r'$-4x^{-1/2}\sin(x+\pi/4)/5$')
ax.legend()
Out[13]:
<matplotlib.legend.Legend at 0x133babe2e10>
No description has been provided for this image
In [ ]: