def phi_magnetic_i_te(radial, theta, phi, wave_number_k): """ Computes the phi component of inciding magnetic field in TE mode. """ result = 0 n = 1 # Due to possible singularity near origin, we approximate null radial # component to a small value. radial = radial or 1E-16 riccati_bessel_list = _riccati_bessel_j(get_max_it(radial), wave_number_k * radial) d_riccati_bessel = riccati_bessel_list[1] max_it = get_max_it(radial) while n <= max_it: for m in DEGREES: increment = m \ * plane_wave_coefficient(n, wave_number_k) \ * beam_shape_g(n, m, mode='TE') \ * d_riccati_bessel[n] \ * legendre_pi(n, abs(m), np.cos(theta)) \ * np.exp(1j * m * phi) result += increment n += 1 return 1j * result / radial
def beam_shape_g_exa(degree, axicon=AXICON, bessel=True): """ Computes exact BSC from equations referenced by the article """ if bessel: return special.j0(float((degree + 1 / 2) * np.sin(axicon))) return (1 + np.cos(axicon)) / (2 * degree * (degree + 1)) \ * (legendre_tau(degree, 1, np.cos(axicon)) \ + legendre_pi(degree, 1, np.cos(axicon)))