Skip to content

plasma_plots.theory.special

Special functions of plasma theory: the Faddeeva function, the plasma dispersion function and complete elliptic integrals, in plain numpy (no scipy needed).

Functions

NameDescription
elliptic_eCompute the complete elliptic integral of the second kind E(m), with parameter m = k².
elliptic_kCompute the complete elliptic integral of the first kind K(m), with parameter m = k².
faddeevaCompute the Faddeeva function w(z) = exp(−z²) erfc(−iz).
plasma_dispersionCompute the plasma dispersion function Z(ζ) of Fried and Conte, or its first derivative.

elliptic_efunction#

def elliptic_e(m)

Compute the complete elliptic integral of the second kind E(m), with parameter m = k².

E(m) = ∫₀^{π/2} √(1 − m sin²θ) dθ, by the arithmetic-geometric mean.

Parameters

NameTypeDescription
mfloat or array_likeThe parameter, m ≤ 1.

Returns

float or numpy.ndarray
E(m); nan for m > 1.

Examples

>>> round(float(elliptic_e(1.0)), 12)
1.0

elliptic_kfunction#

def elliptic_k(m)

Compute the complete elliptic integral of the first kind K(m), with parameter m = k².

K(m) = ∫₀^{π/2} dθ / √(1 − m sin²θ), by the arithmetic-geometric mean.

Parameters

NameTypeDescription
mfloat or array_likeThe parameter, m < 1 (K diverges logarithmically as m → 1).

Returns

float or numpy.ndarray
K(m); inf at m = 1, nan for m > 1.

Examples

>>> round(float(elliptic_k(0.0)), 12) # π/2
1.570796326795

faddeevafunction#

def faddeeva(z)

Compute the Faddeeva function w(z) = exp(−z²) erfc(−iz).

Weideman’s rational approximation with 64 terms in the upper half plane (relative accuracy about 1e-13), continued to the lower half plane with w(z) = 2 exp(−z²) − w(−z).

Parameters

NameTypeDescription
zcomplex or array_likeThe argument.

Returns

complex or numpy.ndarray
w(z), with the shape of z.

Examples

>>> # erfc(1) e¹ at z = i
>>> round(faddeeva(0.0).real, 12), round(faddeeva(1j).real, 6)
(1.0, 0.427584)

plasma_dispersionfunction#

def plasma_dispersion(zeta, derivative: int = 0)

Compute the plasma dispersion function Z(ζ) of Fried and Conte, or its first derivative.

Z(ζ) = i √π w(ζ) is the analytic continuation of (1/√π) ∫ exp(−x²)/(x − ζ) dx from the upper half plane (Landau’s prescription), and Z’(ζ) = −2 [1 + ζ Z(ζ)]. For a Maxwellian f ∝ exp(−v²/(2 v_th²)) the argument is ζ = ω/(√2 k v_th).

Parameters

NameTypeDefaultDescription
zetacomplex or array_likerequiredThe argument ζ.
derivative(0, 1)00 for Z(ζ), 1 for Z’(ζ). Default: 0.

Returns

complex or numpy.ndarray
Z(ζ) or Z’(ζ), with the shape of zeta.

Raises

ValueError
If derivative is not 0 or 1.

Examples

>>> round(plasma_dispersion(0.0).imag, 6) # i √π at the origin
1.772454
>>> plasma_dispersion(0.0, derivative=1)
(-2+0j)