mirror of
https://github.com/Estom/notes.git
synced 2026-02-07 04:23:55 +08:00
35 lines
892 B
Markdown
35 lines
892 B
Markdown
|
|
|
|
## Bessel functions of real order
|
|
> bassel函数
|
|
|
|
$$
|
|
x^2\frac{d^2y}{dx^2}+x\frac{dy}{dx}+(x^2-\alpha^2)y=0
|
|
$$
|
|
```py
|
|
from scipy import special
|
|
def drumhead_height(n, k, distance, angle, t):
|
|
kth_zero = special.jn_zeros(n, k)[-1]
|
|
return np.cos(t) * np.cos(n*angle) * special.jn(n, distance*kth_zero)
|
|
theta = np.r_[0:2*np.pi:50j]
|
|
radius = np.r_[0:1:50j]
|
|
x = np.array([r * np.cos(theta) for r in radius])
|
|
y = np.array([r * np.sin(theta) for r in radius])
|
|
z = np.array([drumhead_height(1, 1, r, theta, 0.5) for r in radius])
|
|
|
|
import matplotlib.pyplot as plt
|
|
from mpl_toolkits.mplot3d import Axes3D
|
|
from matplotlib import cm
|
|
fig = plt.figure()
|
|
ax = Axes3D(fig)
|
|
ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap='RdBu_r', vmin=-0.5, vmax=0.5)
|
|
ax.set_xlabel('X')
|
|
ax.set_ylabel('Y')
|
|
ax.set_zlabel('Z')
|
|
plt.show()
|
|
```
|
|
|
|
## Cython Bindings for Special Functions
|
|
> scipy.special.cython_special
|
|
|