fftl.transforms.hankel#
- fftl.transforms.hankel(mu, r, ar, *args, **kwargs)#
Hankel transform
The Hankel transform is here defined as
\[\tilde{a}(k) = \int_{0}^{\infty} \! a(r) \, J_\mu(kr) \, r \, dr \;,\]where \(J_\mu\) is the Bessel function of order \(\mu\). The order can in general be any real or complex number. The transform is orthogonal and normalised: applied twice, the original function is returned.
The Hankel transform is equivalent to a normalised spherical Hankel transform (
sph_hankel()) with the order and bias shifted by one half. Special cases are \(\mu = 1/2\), which is related to the Fourier sine transform,\[\tilde{a}(k) = \sqrt{\frac{2}{\pi}} \int_{0}^{\infty} \! a(r) \, \frac{\sin(kr)}{\sqrt{kr}} \, r \, dr \;,\]and \(\mu = -1/2\), which is related to the Fourier cosine transform,
\[\tilde{a}(k) = \sqrt{\frac{2}{\pi}} \int_{0}^{\infty} \! a(r) \, \frac{\cos(kr)}{\sqrt{kr}} \, r \, dr \;.\]Examples
Compute the Hankel transform for parameter
mu = 1.>>> # some test function >>> p, q = 2.0, 0.5 >>> r = np.logspace(-2, 2, 1000) >>> ar = r**p*np.exp(-q*r) >>> >>> # compute a biased transform >>> from fftl.transforms import hankel >>> mu = 1.0 >>> k, ak = hankel(mu, r, ar, q=0.1)
Compare with the analytical result.
>>> from scipy.special import gamma, hyp2f1 >>> res = k*q**(-3-p)*gamma(3+p)*hyp2f1((3+p)/2, (4+p)/2, 2, -(k/q)**2)/2 >>> >>> import matplotlib.pyplot as plt >>> plt.plot(k, ak, '-k', label='numerical') >>> plt.plot(k, res, ':r', label='analytical') >>> plt.xscale('log') >>> plt.yscale('symlog', linthresh=1e0, subs=[2, 3, 4, 5, 6, 7, 8, 9]) >>> plt.ylim(-5e-1, 1e2) >>> plt.legend() >>> plt.show()