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
| Name | Description |
|---|---|
elliptic_e | Compute the complete elliptic integral of the second kind E(m), with parameter m = k². |
elliptic_k | Compute the complete elliptic integral of the first kind K(m), with parameter m = k². |
faddeeva | Compute the Faddeeva function w(z) = exp(−z²) erfc(−iz). |
plasma_dispersion | Compute 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
| Name | Type | Description |
|---|---|---|
m | float or array_like | The parameter, m ≤ 1. |
Returns
float or numpy.ndarray- E(m);
nanfor m > 1.
Examples
>>> round(float(elliptic_e(1.0)), 12)1.0elliptic_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
| Name | Type | Description |
|---|---|---|
m | float or array_like | The parameter, m < 1 (K diverges logarithmically as m → 1). |
Returns
float or numpy.ndarray- K(m);
infat m = 1,nanfor m > 1.
Examples
>>> round(float(elliptic_k(0.0)), 12) # π/21.570796326795faddeevafunction#
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
| Name | Type | Description |
|---|---|---|
z | complex or array_like | The 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
| Name | Type | Default | Description |
|---|---|---|---|
zeta | complex or array_like | required | The argument ζ. |
derivative | (0, 1) | 0 | 0 for Z(ζ), 1 for Z’(ζ). Default: 0. |
Returns
complex or numpy.ndarray- Z(ζ) or Z’(ζ), with the shape of
zeta.
Raises
ValueError- If
derivativeis not 0 or 1.
Examples
>>> round(plasma_dispersion(0.0).imag, 6) # i √π at the origin1.772454>>> plasma_dispersion(0.0, derivative=1)(-2+0j)