def theta_electric_i_te(radial, theta, phi, wave_number_k, degrees=[-1, 1], bscs={}): """ Computes the theta component of inciding electric 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), wave_number_k * radial) riccati_bessel = riccati_bessel_list[0] max_it = get_max_it(radial, wave_number_k) while n <= max_it: for m in degrees: if n >= m: increment = m \ * plane_wave_coefficient(n, wave_number_k) \ * bscs[(n, m)] \ * riccati_bessel[n] \ * legendre_pi(n, abs(m), np.cos(theta)) \ * np.exp(1j * m * phi) result += increment n += 1 return result / radial
def radial_electric_i_tm(radial, theta, phi, wave_number_k, degrees=[-1, 1], bscs={}): """ Computes the radial component of incident electric field in TM mode. """ result = 0 n = 1 riccati_bessel_list = _riccati_bessel_j(get_max_it(radial, wave_number_k), wave_number_k * radial) riccati_bessel = riccati_bessel_list[0] max_it = get_max_it(radial, wave_number_k) # while n <= get_max_it(radial, wave_number_k): while n <= max_it: for m in degrees: if n >= m: increment = plane_wave_coefficient(n, wave_number_k) \ * bscs[(n, m)] \ * (d2_riccati_bessel_j(n, wave_number_k * radial) + riccati_bessel[n]) \ * legendre_p(n, abs(m), np.cos(theta)) \ * np.exp(1j * m * phi) result += increment n += 1 return wave_number_k * result