Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Layered media, reaction field components and M2L integrals of the Maxwell FMM in layered media

Definition
Arxiv2507_18491_Basic

by Xeroth · Nov 26, 2026 · Mathlib 0df444a (Lean v4.33.1)

chebyshev-polynomialsdyadic-greens-functionfast-multipole-methodlayered-mediasommerfeld-integrals

Objects of Sections 3.1-3.4 and Appendices A-B of Yuan, Wang, Zhang and Cai (2025).

  1. Layered medium (Section 3.1). There are L+1L+1L+1 horizontal layers 0,…,L0,\dots,L0,…,L from top to bottom. The interface between layer ℓ\ellℓ and layer ℓ+1\ell+1ℓ+1 is the plane z=dℓz=d_\ellz=dℓ​, 0≤ℓ≤L−10\le\ell\le L-10≤ℓ≤L−1, with d0>⋯>dL−1d_0>\dots>d_{L-1}d0​>⋯>dL−1​. Layer ℓ\ellℓ has permittivity εℓ>0\varepsilon_\ell>0εℓ​>0, permeability μℓ>0\mu_\ell>0μℓ​>0 and wave number kℓ=ωεℓμℓk_\ell=\omega\sqrt{\varepsilon_\ell\mu_\ell}kℓ​=ωεℓ​μℓ​​ (eq. 3.1). A height zzz lies in layer ℓ\ellℓ if dℓ<z<dℓ−1d_\ell<z<d_{\ell-1}dℓ​<z<dℓ−1​; layer 000 is unbounded above and layer LLL is unbounded below. The vertical wave number is kℓz=kℓ2−kρ2k_{\ell z}=\sqrt{k_\ell^2-k_\rho^2}kℓz​=kℓ2​−kρ2​​ with Im⁡kℓz≥0\operatorname{Im}k_{\ell z}\ge0Imkℓz​≥0. For real kρk_\rhokρ​ this is kℓ2−kρ2≥0\sqrt{k_\ell^2-k_\rho^2}\ge0kℓ2​−kρ2​​≥0 when kρ≤kℓk_\rho\le k_\ellkρ​≤kℓ​, and ikρ2−kℓ2\mathrm i\sqrt{k_\rho^2-k_\ell^2}ikρ2​−kℓ2​​ otherwise.
  2. Spectral Green's function (eq. 3.3). For coefficient functions ϕ,ψ,ψ~\phi,\psi,\tilde\psiϕ,ψ,ψ~​ of (z,z′)(z,z')(z,z′) in the target layer ℓ\ellℓ,
G^E=−iωkℓ2(kℓ2ϕJ1+μℓkρ2ψJ2+μℓ∂zψJ3+μℓψ~J4+kℓ2ϕ+μℓ∂zψ~kρ2J5),\widehat{\boldsymbol G}_E=-\frac{\mathrm i\omega}{k_\ell^2}\Big(k_\ell^2\phi J_1+\mu_\ell k_\rho^2\psi J_2+\mu_\ell\partial_z\psi J_3+\mu_\ell\tilde\psi J_4+\frac{k_\ell^2\phi+\mu_\ell\partial_z\tilde\psi}{k_\rho^2}J_5\Big),GE​=−kℓ2​iω​(kℓ2​ϕJ1​+μℓ​kρ2​ψJ2​+μℓ​∂z​ψJ3​+μℓ​ψ~​J4​+kρ2​kℓ2​ϕ+μℓ​∂z​ψ~​​J5​),

without the term δ\boldsymbol\deltaδ, which is supported on z=z′z=z'z=z′. Here J1,…,J5J_1,\dots,J_5J1​,…,J5​ are the 3×33\times33×3 matrices (3.5), and (kρ,α)(k_\rho,\alpha)(kρ​,α) are the polar coordinates of (kx,ky)(k_x,k_y)(kx​,ky​). 3. Reaction field exponentials (eqs. 3.9-3.11, 3.21-3.24). τℓ(z)=2dℓ−z\tau_\ell(z)=2d_\ell-zτℓ​(z)=2dℓ​−z. For a component (∗,⋆)∈{↑,↓}2(\ast,\star)\in\{\uparrow,\downarrow\}^2(∗,⋆)∈{↑,↓}2 (∗\ast∗ is the direction of the wave arriving at the target, ⋆\star⋆ the direction of the wave leaving the source), Zℓℓ′∗⋆(kρ,z,z′)Z^{\ast\star}_{\ell\ell'}(k_\rho,z,z')Zℓℓ′∗⋆​(kρ​,z,z′) is the exponential (3.9) and sℓℓ′∗⋆=±1s^{\ast\star}_{\ell\ell'}=\pm1sℓℓ′∗⋆​=±1 is the sign (3.11). The effective location τ^ℓℓ′∗⋆(r)\hat\tau^{\ast\star}_{\ell\ell'}(\boldsymbol r)τ^ℓℓ′∗⋆​(r) of a target and the equivalent polarization coordinate τ˘ℓℓ′⋆(r′)\breve\tau^{\star}_{\ell\ell'}(\boldsymbol r')τ˘ℓℓ′⋆​(r′) of a source (3.21)-(3.22) replace the height by its mirror image in an adjacent interface, or keep it. The vertical transmission distance is ∣z^−z˘∣|\hat z-\breve z|∣z^−z˘∣, the vertical part of (3.24). A component is defined when every interface index that occurs in its case of (3.9) lies in {0,…,L−1}\{0,\dots,L-1\}{0,…,L−1}. 4. Reaction parts (eq. 3.8). For density functions ϕℓℓ′∗⋆(kρ)\phi^{\ast\star}_{\ell\ell'}(k_\rho)ϕℓℓ′∗⋆​(kρ​) and ψℓℓ′∗⋆(kρ)\psi^{\ast\star}_{\ell\ell'}(k_\rho)ψℓℓ′∗⋆​(kρ​), the reaction parts of ϕℓ\phi_\ellϕℓ​ and ψℓ\psi_\ellψℓ​ are −12ωkℓ′z∑∗,⋆ϕℓℓ′∗⋆Zℓℓ′∗⋆-\frac{1}{2\omega k_{\ell'z}}\sum_{\ast,\star}\phi^{\ast\star}_{\ell\ell'}Z^{\ast\star}_{\ell\ell'}−2ωkℓ′z​1​∑∗,⋆​ϕℓℓ′∗⋆​Zℓℓ′∗⋆​ and −12ωμℓ′kℓ′z∑∗,⋆ψℓℓ′∗⋆Zℓℓ′∗⋆-\frac{1}{2\omega\mu_{\ell'}k_{\ell'z}}\sum_{\ast,\star}\psi^{\ast\star}_{\ell\ell'}Z^{\ast\star}_{\ell\ell'}−2ωμℓ′​kℓ′z​1​∑∗,⋆​ψℓℓ′∗⋆​Zℓℓ′∗⋆​. 5. Reaction components (eqs. 3.13-3.14, 3.16-3.19). Θℓℓ′∗⋆\Theta^{\ast\star}_{\ell\ell'}Θℓℓ′∗⋆​ is the matrix (3.14), and G^ℓℓ′∗⋆=iZℓℓ′∗⋆Θℓℓ′∗⋆/(2kℓ′z)\widehat{\boldsymbol G}^{\ast\star}_{\ell\ell'}=\mathrm iZ^{\ast\star}_{\ell\ell'}\Theta^{\ast\star}_{\ell\ell'}/(2k_{\ell'z})Gℓℓ′∗⋆​=iZℓℓ′∗⋆​Θℓℓ′∗⋆​/(2kℓ′z​). Gℓℓ′∗⋆(r,r′)\boldsymbol G^{\ast\star}_{\ell\ell'}(\boldsymbol r,\boldsymbol r')Gℓℓ′∗⋆​(r,r′) is its inverse Fourier transform (3.18), computed entry by entry. M1,…,M6M_1,\dots,M_6M1​,…,M6​ are the constant matrices displayed after (3.15), and γℓℓ′=μℓ/(μℓ′kℓ2)\gamma_{\ell\ell'}=\mu_\ell/(\mu_{\ell'}k_\ell^2)γℓℓ′​=μℓ​/(μℓ′​kℓ2​). σ1,σ2,σ4,σ5\sigma_1,\sigma_2,\sigma_4,\sigma_5σ1​,σ2​,σ4​,σ5​ are the densities (3.16)-(3.17). Both σ3\sigma_3σ3​ as printed in (3.16) and the density σ3c\sigma_3^{c}σ3c​ that (3.14) actually produces are defined: σ3c=ϕ/kℓ′z+γℓℓ′kℓzψ\sigma_3^{c}=\phi/k_{\ell'z}+\gamma_{\ell\ell'}k_{\ell z}\psiσ3c​=ϕ/kℓ′z​+γℓℓ′​kℓz​ψ for ↑↓,↓↑\uparrow\downarrow,\downarrow\uparrow↑↓,↓↑ and ϕ/kℓ′z−γℓℓ′kℓzψ\phi/k_{\ell'z}-\gamma_{\ell\ell'}k_{\ell z}\psiϕ/kℓ′z​−γℓℓ′​kℓz​ψ for ↑↑,↓↓\uparrow\uparrow,\downarrow\downarrow↑↑,↓↓. The operator (3.19) is

Lℓℓ′κ∗⋆[σ](r,r′)=i8π2∬R2Eℓℓ′∗⋆(τ^(r),τ˘(r′))eiκασ(kρ) dkxdky,\mathcal L^{\ast\star}_{\ell\ell'\kappa}[\sigma](\boldsymbol r,\boldsymbol r')=\frac{\mathrm i}{8\pi^2}\iint_{\mathbb R^2}\mathcal E^{\ast\star}_{\ell\ell'}\big(\hat\tau(\boldsymbol r),\breve\tau(\boldsymbol r')\big)e^{\mathrm i\kappa\alpha}\sigma(k_\rho)\,dk_xdk_y,Lℓℓ′κ∗⋆​[σ](r,r′)=8π2i​∬R2​Eℓℓ′∗⋆​(τ^(r),τ˘(r′))eiκασ(kρ​)dkx​dky​,

where E(r,r′)=eikx(x−x′)+iky(y−y′)es(ikℓzz−ikℓ′zz′)\mathcal E(\boldsymbol r,\boldsymbol r')=e^{\mathrm ik_x(x-x')+\mathrm ik_y(y-y')}e^{s(\mathrm ik_{\ell z}z-\mathrm ik_{\ell'z}z')}E(r,r′)=eikx​(x−x′)+iky​(y−y′)es(ikℓz​z−ikℓ′z​z′) (3.20). 6. Integrals of Sections 3.3-3.4 (eqs. 3.28, 3.44-3.45). These are

Inmκνμ=cnmνμ2π∬E ei(m−μ+κ)αP^nm(kz/k)P^νμ(kz′/k′)σ(kρ) dkxdky,cnmνμ=sn+ν+m+μin+ν+1,\mathcal I^{\nu\mu}_{nm\kappa}=\frac{c^{\nu\mu}_{nm}}{2\pi}\iint\mathcal E\,e^{\mathrm i(m-\mu+\kappa)\alpha}\widehat P_n^m(k_z/k)\widehat P_\nu^\mu(k'_z/k')\sigma(k_\rho)\,dk_xdk_y,\qquad c^{\nu\mu}_{nm}=s^{n+\nu+m+\mu}\mathrm i^{n+\nu+1},Inmκνμ​=2πcnmνμ​​∬Eei(m−μ+κ)αPnm​(kz​/k)Pνμ​(kz′​/k′)σ(kρ​)dkx​dky​,cnmνμ​=sn+ν+m+μin+ν+1,

and the Sommerfeld-type integral I^nmκνμ=∫0∞kρJm−μ+κ(kρρ)Z P^nmP^νμσ dkρ\widehat{\mathcal I}^{\nu\mu}_{nm\kappa}=\int_0^\infty k_\rho J_{m-\mu+\kappa}(k_\rho\rho)\mathcal Z\,\widehat P_n^m\widehat P_\nu^\mu\sigma\,dk_\rhoInmκνμ​=∫0∞​kρ​Jm−μ+κ​(kρ​ρ)ZPnm​Pνμ​σdkρ​. JnJ_nJn​ is the Bessel function, given by its integral representation Jn(x)=12πin∫02πeixcos⁡θ+inθdθJ_n(x)=\frac1{2\pi\mathrm i^n}\int_0^{2\pi}e^{\mathrm ix\cos\theta+\mathrm in\theta}d\thetaJn​(x)=2πin1​∫02π​eixcosθ+inθdθ. 7. Chebyshev expansions (Appendices A-B, eq. 3.49). TnT_nTn​ is the Chebyshev polynomial of the first kind. CjsabC^{ab}_{js}Cjsab​ are the coefficients given by the recurrence (A.2), with the initial value C11ab=aC^{ab}_{11}=aC11ab​=a, which (A.2) uses but does not list. sgn(x)=(−1)min⁡(0,x)\mathrm{sgn}(x)=(-1)^{\min(0,x)}sgn(x)=(−1)min(0,x). τnm(θ)\tau_{nm}(\theta)τnm​(θ) and KnK_nKn​ are the prefactor and number of terms of (B.1). 8. FMM boxes (Section 3.4.1). A box is a closed axis-parallel cube, given by its centre and side length.

Formalization Note The density functions ϕℓℓ′∗⋆\phi^{\ast\star}_{\ell\ell'}ϕℓℓ′∗⋆​ and ψℓℓ′∗⋆\psi^{\ast\star}_{\ell\ell'}ψℓℓ′∗⋆​ are arbitrary functions of kρk_\rhokρ​: the paper says only that they are computed from the layer structure by recurrences in other references. Likewise the normalized associated Legendre function P^nm\widehat P_n^mPnm​ is an arbitrary family P n m: the paper uses it in (3.28) without giving its normalization, and statements that need its symmetry P^n−m=(−1)mP^nm\widehat P_n^{-m}=(-1)^m\widehat P_n^mPn−m​=(−1)mPnm​ take that symmetry as a hypothesis. Points of R3\mathbb R^3R3 are triples (x,y,z)(x,y,z)(x,y,z), and the factor eiαe^{\mathrm i\alpha}eiα is (kx+iky)/kρ(k_x+\mathrm ik_y)/k_\rho(kx​+iky​)/kρ​, which is set to 000 on the null set kρ=0k_\rho=0kρ​=0.

Definition code
import Mathlib

/-!
H. Yuan, B. Wang, W. Zhang and W. Cai, *Fast multipole method for Maxwell's equations in layered
media*, arXiv:2507.18491v1 (2025): the layered medium and vertical wave numbers (Section 3.1,
eqs. (3.1), (3.3)-(3.5)), the reaction-field decomposition and its exponentials, signs, equivalent
polarization coordinates and effective locations (eqs. (3.8)-(3.24)), the matrix basis and
densities of the reaction field components (eqs. (3.13)-(3.19)), the integrals of Sections 3.3-3.4
(eqs. (3.28), (3.44)-(3.45)), the Chebyshev coefficients of Appendix A (eqs. (A.1)-(A.2)) and the
factors of the Chebyshev expansion of the associated Legendre functions of Appendix B (eq. (B.1)).
-/

open MeasureTheory

noncomputable section

namespace Arxiv2507_18491

/-- Section 3.1: the vertical propagation directions `↑` (upward, `true`) and `↓` (downward,
`false`). A reaction field component is labelled by a pair `(∗, ⋆)`: `∗` is the direction of the
wave arriving at the target, `⋆` the direction of the wave leaving the source. -/
abbrev Dir := Bool

/-- Eq. (3.1): the wave number `k_ℓ = ω √(ε_ℓ μ_ℓ)` of layer `ℓ`. -/
def waveNum (omega : ℝ) (epsL muL : ℕ → ℝ) (l : ℕ) : ℝ := omega * Real.sqrt (epsL l * muL l)

/-- Section 3.1 (after eq. (3.7)): the vertical wave number `k_{ℓz} = √(k_ℓ² - k_ρ²)` with the
branch `Im k_{ℓz} ≥ 0`, for a real wave number `k = k_ℓ` and a real spectral variable `k_ρ`:
the nonnegative square root when `k_ρ² ≤ k²` and `i √(k_ρ² - k²)` otherwise. -/
def vkz (k krho : ℝ) : ℂ :=
  if krho ^ 2 ≤ k ^ 2 then ((Real.sqrt (k ^ 2 - krho ^ 2) : ℝ) : ℂ)
  else Complex.I * ((Real.sqrt (krho ^ 2 - k ^ 2) : ℝ) : ℂ)

/-- Section 3.1: the interfaces `z = d_ℓ`, `0 ≤ ℓ ≤ L - 1`, between layer `ℓ` and layer `ℓ + 1`
satisfy `d_0 > ⋯ > d_{L-1}` (only the values `d 0, …, d (L - 1)` are interfaces). -/
def IsInterfaces (L : ℕ) (d : ℕ → ℝ) : Prop := ∀ i j : ℕ, i < j → j < L → d j < d i

/-- Section 3.1 (eq. (3.3)): the height `z` lies strictly inside layer `ℓ ∈ {0, …, L}`, i.e.
`d_ℓ < z < d_{ℓ-1}`, where layer `0` is unbounded above and layer `L` is unbounded below. -/
def InLayer (L : ℕ) (d : ℕ → ℝ) (l : ℕ) (z : ℝ) : Prop :=
  l ≤ L ∧ (l = 0 ∨ z < d (l - 1)) ∧ (l = L ∨ d l < z)

/-- Eq. (3.10): the reflection `τ_ℓ(z) = 2 d_ℓ - z` in the interface `z = d_ℓ`. -/
def refl (d : ℕ → ℝ) (l : ℕ) (z : ℝ) : ℝ := 2 * d l - z

/-- Eq. (3.11): the sign `s^{∗⋆}_{ℓℓ'}`; it depends only on `⋆ = b`:
`s^{∗↓}_{ℓℓ'} = 1` for `ℓ ≤ ℓ'` and `-1` for `ℓ > ℓ'`; `s^{∗↑}_{ℓℓ'} = 1` for `ℓ < ℓ'` and `-1`
for `ℓ ≥ ℓ'`. -/
def sgnS (l l' : ℕ) (b : Dir) : ℝ :=
  if b then (if l < l' then 1 else -1) else (if l ≤ l' then 1 else -1)

/-- Eq. (3.9): the reaction field component `(∗, ⋆) = (a, b)` for target layer `ℓ` and source
layer `ℓ'` (both in `{0, …, L}`) is defined: every interface index occurring in its case of
(3.9) lies in `{0, …, L - 1}` (the reflections `τ_{ℓ-1}` and `τ_ℓ` need an interface above,
respectively below, the layer). -/
def CompDefined (L l l' : ℕ) (a b : Dir) : Prop :=
  match a, b with
  | true, true => l < l' ∨ (1 ≤ l' ∧ l + 1 ≤ L)
  | true, false => (l ≤ l' ∧ l' + 1 ≤ L) ∨ (l' < l ∧ l + 1 ≤ L)
  | false, true => (l < l' ∧ 1 ≤ l) ∨ (l' ≤ l ∧ 1 ≤ l')
  | false, false => (l ≤ l' ∧ 1 ≤ l ∧ l' + 1 ≤ L) ∨ l' < l

/-- Eq. (3.9): the exponentials `Z^{∗⋆}_{ℓℓ'}(k_ρ, z, z')` of the reaction field components,
`(∗, ⋆) = (a, b)`, for target height `z` in layer `ℓ` and source height `z'` in layer `ℓ'`;
`k j` is the wave number of layer `j`, and `k_{ℓz}`, `k_{ℓ'z}` are the vertical wave numbers. -/
def Zfun (k : ℕ → ℝ) (d : ℕ → ℝ) (l l' : ℕ) (a b : Dir) (krho z z' : ℝ) : ℂ :=
  let kz : ℂ := vkz (k l) krho
  let kz' : ℂ := vkz (k l') krho
  match a, b with
  | true, true =>
    if l < l' then Complex.exp (Complex.I * (kz * z - kz' * z'))
    else Complex.exp (Complex.I * (kz' * refl d (l' - 1) z' - kz * refl d l z))
  | true, false =>
    if l ≤ l' then Complex.exp (Complex.I * (kz * z - kz' * refl d l' z'))
    else Complex.exp (Complex.I * (kz' * z' - kz * refl d l z))
  | false, true =>
    if l < l' then Complex.exp (Complex.I * (kz * refl d (l - 1) z - kz' * z'))
    else Complex.exp (Complex.I * (kz' * refl d (l' - 1) z' - kz * z))
  | false, false =>
    if l ≤ l' then Complex.exp (Complex.I * (kz * refl d (l - 1) z - kz' * refl d l' z'))
    else Complex.exp (Complex.I * (kz' * z' - kz * z))

/-- Eq. (3.22): the height of the effective location `τ̂^{∗⋆}_{ℓℓ'}(r)` of a target at height
`z` (by eq. (3.23), `τ_ℓ(r) = (x, y, τ_ℓ(z))` changes only the height). -/
def effZ (d : ℕ → ℝ) (l l' : ℕ) (a b : Dir) (z : ℝ) : ℝ :=
  match a, b with
  | true, true => if l < l' then z else refl d l z
  | true, false => if l ≤ l' then z else refl d l z
  | false, true => if l < l' then refl d (l - 1) z else z
  | false, false => if l ≤ l' then refl d (l - 1) z else z

/-- Eq. (3.21): the height of the equivalent polarization coordinate `τ̆^⋆_{ℓℓ'}(r')` of a source
at height `z'`. -/
def polZ (d : ℕ → ℝ) (l l' : ℕ) (b : Dir) (z' : ℝ) : ℝ :=
  if b then (if l < l' then z' else refl d (l' - 1) z')
  else (if l ≤ l' then refl d l' z' else z')

/-- Eqs. (3.22)-(3.23): the effective location `τ̂^{∗⋆}_{ℓℓ'}(r)` of a target `r = (x, y, z)`. -/
def effLoc (d : ℕ → ℝ) (l l' : ℕ) (a b : Dir) (r : ℝ × ℝ × ℝ) : ℝ × ℝ × ℝ :=
  (r.1, r.2.1, effZ d l l' a b r.2.2)

/-- Eqs. (3.21), (3.23): the equivalent polarization coordinate `τ̆^⋆_{ℓℓ'}(r')` of a source
`r' = (x', y', z')`. -/
def polLoc (d : ℕ → ℝ) (l l' : ℕ) (b : Dir) (r' : ℝ × ℝ × ℝ) : ℝ × ℝ × ℝ :=
  (r'.1, r'.2.1, polZ d l l' b r'.2.2)

/-- Section 3.2 and eq. (3.24): the vertical transmission distance of the component `(∗, ⋆)`, the
vertical part `|ẑ - z̆|` of the field transmission distance `|τ̂^{∗⋆}_{ℓℓ'}(r) - τ̆^⋆_{ℓℓ'}(r')|`. -/
def vertDist (d : ℕ → ℝ) (l l' : ℕ) (a b : Dir) (z z' : ℝ) : ℝ :=
  |effZ d l l' a b z - polZ d l l' b z'|

/-- Eq. (3.5): `J_1 = diag(1, 1, 0)`. -/
def J1 : Matrix (Fin 3) (Fin 3) ℂ := !![1, 0, 0; 0, 1, 0; 0, 0, 0]

/-- Eq. (3.5): `J_2 = diag(0, 0, 1)`. -/
def J2 : Matrix (Fin 3) (Fin 3) ℂ := !![0, 0, 0; 0, 0, 0; 0, 0, 1]

/-- Eq. (3.5): `J_3`, with entries `i k_x`, `i k_y` in the third column. -/
def J3 (kx ky : ℝ) : Matrix (Fin 3) (Fin 3) ℂ :=
  !![0, 0, Complex.I * (kx : ℂ); 0, 0, Complex.I * (ky : ℂ); 0, 0, 0]

/-- Eq. (3.5): `J_4`, with entries `i k_x`, `i k_y` in the third row. -/
def J4 (kx ky : ℝ) : Matrix (Fin 3) (Fin 3) ℂ :=
  !![0, 0, 0; 0, 0, 0; Complex.I * (kx : ℂ), Complex.I * (ky : ℂ), 0]

/-- Eq. (3.5): `J_5 = -[[k_x², k_x k_y, 0], [k_x k_y, k_y², 0], [0, 0, 0]]`. -/
def J5 (kx ky : ℝ) : Matrix (Fin 3) (Fin 3) ℂ :=
  !![-((kx : ℂ) ^ 2), -((kx : ℂ) * ky), 0; -((kx : ℂ) * ky), -((ky : ℂ) ^ 2), 0; 0, 0, 0]

/-- Section 3.1, matrix `M_1` (display after eq. (3.15)). -/
def M1 : Matrix (Fin 3) (Fin 3) ℂ := !![1 / 2, 0, 0; 0, 1 / 2, 0; 0, 0, 0]

/-- Section 3.1, matrix `M_2` (display after eq. (3.15)). -/
def M2 : Matrix (Fin 3) (Fin 3) ℂ :=
  !![-1 / 4, Complex.I / 4, 0; Complex.I / 4, 1 / 4, 0; 0, 0, 0]

/-- Section 3.1, matrix `M_3` (display after eq. (3.15)). -/
def M3 : Matrix (Fin 3) (Fin 3) ℂ :=
  !![-1 / 4, -Complex.I / 4, 0; -Complex.I / 4, 1 / 4, 0; 0, 0, 0]

/-- Section 3.1, matrix `M_4` (display after eq. (3.15)). -/
def M4 : Matrix (Fin 3) (Fin 3) ℂ := !![0, 0, 1 / 2; 0, 0, -Complex.I / 2; 0, 0, 0]

/-- Section 3.1, matrix `M_5` (display after eq. (3.15)). -/
def M5 : Matrix (Fin 3) (Fin 3) ℂ := !![0, 0, 1 / 2; 0, 0, Complex.I / 2; 0, 0, 0]

/-- Section 3.1, matrix `M_6` (display after eq. (3.15)). -/
def M6 : Matrix (Fin 3) (Fin 3) ℂ := !![0, 0, 0; 0, 0, 0; 0, 0, 1]

/-- `k_ρ = √(k_x² + k_y²)`, the radial polar coordinate of `(k_x, k_y)` (eq. (3.4)). -/
def krhoOf (kx ky : ℝ) : ℝ := Real.sqrt (kx ^ 2 + ky ^ 2)

/-- Eq. (3.4): `e^{iα}` for the polar angle `α` of `(k_x, k_y)`, i.e. `(k_x + i k_y) / k_ρ`
(equal to `0` at the origin, a null set). -/
def eia (kx ky : ℝ) : ℂ := ((kx : ℂ) + (ky : ℂ) * Complex.I) / (krhoOf kx ky : ℂ)

/-- Eq. (3.3) without the term `δ`, which is supported on `z = z'` and carries the factor
`δ_{ℓℓ'}`: the spectral electric dyadic Green's function
`-(iω/k_ℓ²)(k_ℓ² φ J_1 + μ_ℓ k_ρ² ψ J_2 + μ_ℓ ∂_z ψ J_3 + μ_ℓ ψ̃ J_4 + (k_ℓ² φ + μ_ℓ ∂_z ψ̃)/k_ρ² J_5)`
built from coefficient functions `φ(z, z')`, `ψ(z, z')`, `ψ̃(z, z')` of the target layer `ℓ`, with
`kl = k_ℓ` and `mul = μ_ℓ`. -/
def specGE (omega kl mul kx ky : ℝ) (phi psi psiT : ℝ → ℝ → ℂ) (z z' : ℝ) :
    Matrix (Fin 3) (Fin 3) ℂ :=
  let kr2 : ℂ := ((kx ^ 2 + ky ^ 2 : ℝ) : ℂ)
  (-(Complex.I * (omega : ℂ)) / (kl : ℂ) ^ 2) •
    (((kl : ℂ) ^ 2 * phi z z') • J1 + ((mul : ℂ) * kr2 * psi z z') • J2
      + ((mul : ℂ) * deriv (fun w => psi w z') z) • J3 kx ky
      + ((mul : ℂ) * psiT z z') • J4 kx ky
      + (((kl : ℂ) ^ 2 * phi z z' + (mul : ℂ) * deriv (fun w => psiT w z') z) / kr2) • J5 kx ky)

/-- Eq. (3.8), first line without the free-space part: the reaction part
`-(1/(2ω k_{ℓ'z})) Σ_{∗,⋆} φ^{∗⋆}_{ℓℓ'}(k_ρ) Z^{∗⋆}_{ℓℓ'}(k_ρ, z, z')` of `φ_ℓ`, for density
functions `phiD ∗ ⋆` of `k_ρ`. -/
def phiReac (omega : ℝ) (k : ℕ → ℝ) (d : ℕ → ℝ) (l l' : ℕ) (phiD : Dir → Dir → ℝ → ℂ)
    (krho z z' : ℝ) : ℂ :=
  -(2 * (omega : ℂ) * vkz (k l') krho)⁻¹ *
    ∑ a : Dir, ∑ b : Dir, phiD a b krho * Zfun k d l l' a b krho z z'

/-- Eq. (3.8), second line without the free-space part: the reaction part
`-(1/(2ω μ_{ℓ'} k_{ℓ'z})) Σ_{∗,⋆} ψ^{∗⋆}_{ℓℓ'}(k_ρ) Z^{∗⋆}_{ℓℓ'}(k_ρ, z, z')` of `ψ_ℓ`. -/
def psiReac (omega : ℝ) (k muL : ℕ → ℝ) (d : ℕ → ℝ) (l l' : ℕ) (psiD : Dir → Dir → ℝ → ℂ)
    (krho z z' : ℝ) : ℂ :=
  -(2 * (omega : ℂ) * (muL l' : ℂ) * vkz (k l') krho)⁻¹ *
    ∑ a : Dir, ∑ b : Dir, psiD a b krho * Zfun k d l l' a b krho z z'

/-- Section 3.1 (before eq. (3.16)): `γ_{ℓℓ'} = μ_ℓ / (μ_{ℓ'} k_ℓ²)`, with `kl = k_ℓ`,
`mul = μ_ℓ`, `mul' = μ_{ℓ'}`. -/
def gam (kl mul mul' : ℝ) : ℂ := (mul : ℂ) / ((mul' : ℂ) * (kl : ℂ) ^ 2)

/-- Eq. (3.14): the matrix `Θ^{∗⋆}_{ℓℓ'}(k_x, k_y)` of the component `(∗, ⋆) = (a, b)`,
`φ (J_1 + J_5/k_ρ²) + (μ_ℓ ψ/(μ_{ℓ'} k_ℓ²)) (k_ρ² J_2 + c₃ i k_{ℓz} J_3 + c₄ i k_{ℓ'z} J_4
+ c₅ (k_{ℓz} k_{ℓ'z}/k_ρ²) J_5)` with the signs `(c₃, c₄, c₅)` printed in (3.14):
`(+,-,+)` for `↑↓`, `(+,+,-)` for `↑↑`, `(-,-,-)` for `↓↓`, `(-,+,+)` for `↓↑`; here `phi`, `psi`
are the values `φ^{∗⋆}_{ℓℓ'}(k_ρ)`, `ψ^{∗⋆}_{ℓℓ'}(k_ρ)`. -/
def Theta (kl kl' mul mul' : ℝ) (a b : Dir) (phi psi : ℂ) (kx ky : ℝ) :
    Matrix (Fin 3) (Fin 3) ℂ :=
  let kr2 : ℂ := ((kx ^ 2 + ky ^ 2 : ℝ) : ℂ)
  let kz : ℂ := vkz kl (krhoOf kx ky)
  let kz' : ℂ := vkz kl' (krhoOf kx ky)
  let c : ℂ × ℂ × ℂ :=
    match a, b with
    | true, false => (1, -1, 1)
    | true, true => (1, 1, -1)
    | false, false => (-1, -1, -1)
    | false, true => (-1, 1, 1)
  phi • (J1 + kr2⁻¹ • J5 kx ky)
    + (gam kl mul mul' * psi) • (kr2 • J2 + (c.1 * Complex.I * kz) • J3 kx ky
      + (c.2.1 * Complex.I * kz') • J4 kx ky + (c.2.2 * kz * kz' / kr2) • J5 kx ky)

/-- Eq. (3.13): the spectral reaction field component
`Ĝ^{∗⋆}_{ℓℓ'}(k_x, k_y, z, z') = i Z^{∗⋆}_{ℓℓ'}(k_ρ, z, z') / (2 k_{ℓ'z}) Θ^{∗⋆}_{ℓℓ'}(k_x, k_y)`,
for the densities `phiD`, `psiD` (functions of `k_ρ`) of the component `(a, b)`. -/
def GhatReac (k muL : ℕ → ℝ) (d : ℕ → ℝ) (l l' : ℕ) (a b : Dir) (phiD psiD : ℝ → ℂ)
    (kx ky z z' : ℝ) : Matrix (Fin 3) (Fin 3) ℂ :=
  (Complex.I * Zfun k d l l' a b (krhoOf kx ky) z z' / (2 * vkz (k l') (krhoOf kx ky))) •
    Theta (k l) (k l') (muL l) (muL l') a b (phiD (krhoOf kx ky)) (psiD (krhoOf kx ky)) kx ky

/-- Eq. (3.18), first line: the `(i, j)` entry of the physical-space reaction field component
`G^{∗⋆}_{ℓℓ'}(r, r') = (1/4π²) ∬ Ĝ^{∗⋆}_{ℓℓ'} e^{i k_x (x - x') + i k_y (y - y')} dk_x dk_y`
(inverse Fourier transform (3.2)). -/
def GReac (k muL : ℕ → ℝ) (d : ℕ → ℝ) (l l' : ℕ) (a b : Dir) (phiD psiD : ℝ → ℂ)
    (r r' : ℝ × ℝ × ℝ) (i j : Fin 3) : ℂ :=
  (4 * (Real.pi : ℂ) ^ 2)⁻¹ * ∫ p : ℝ × ℝ,
    GhatReac k muL d l l' a b phiD psiD p.1 p.2 r.2.2 r'.2.2 i j *
      Complex.exp (Complex.I * ((p.1 : ℂ) * (r.1 - r'.1) + (p.2 : ℂ) * (r.2.1 - r'.2.1)))

/-- Eq. (3.16): `σ^{∗⋆}_{ℓℓ'1} = φ^{∗⋆}_{ℓℓ'}/k_{ℓ'z} ∓ γ_{ℓℓ'} k_{ℓz} ψ^{∗⋆}_{ℓℓ'}`, with `-` for
`↑↓`, `↓↑` and `+` for `↑↑`, `↓↓`; `kl = k_ℓ`, `kl' = k_{ℓ'}`, `mul = μ_ℓ`, `mul' = μ_{ℓ'}`. -/
def sig1 (kl kl' mul mul' : ℝ) (a b : Dir) (phiD psiD : ℝ → ℂ) (krho : ℝ) : ℂ :=
  phiD krho / vkz kl' krho + (if a = b then 1 else -1) * gam kl mul mul' * vkz kl krho * psiD krho

/-- Eq. (3.16) as printed: `σ^{∗↓}_{ℓℓ'3} = φ/k_{ℓ'z} + γ_{ℓℓ'} k_{ℓz} ψ` and
`σ^{∗↑}_{ℓℓ'3} = φ/k_{ℓ'z} - γ_{ℓℓ'} k_{ℓz} ψ`. (Not used by the statements: substituting into
(3.14) gives `sig3c`, which differs from it for `↓↑` and `↓↓`.) -/
def sig3 (kl kl' mul mul' : ℝ) (b : Dir) (phiD psiD : ℝ → ℂ) (krho : ℝ) : ℂ :=
  phiD krho / vkz kl' krho + (if b then -1 else 1) * gam kl mul mul' * vkz kl krho * psiD krho

/-- The density multiplying `e^{±2iα} M_2`, `M_3` that the substitution of the identities after
(3.15) into (3.14) produces (Section 3.1, display after (3.17)):
`φ/k_{ℓ'z} + γ_{ℓℓ'} k_{ℓz} ψ` for `↑↓`, `↓↑` and `φ/k_{ℓ'z} - γ_{ℓℓ'} k_{ℓz} ψ` for `↑↑`, `↓↓`.
It agrees with the printed `σ_{ℓℓ'3}` of (3.16) for `↑↓`, `↑↑`. -/
def sig3c (kl kl' mul mul' : ℝ) (a b : Dir) (phiD psiD : ℝ → ℂ) (krho : ℝ) : ℂ :=
  phiD krho / vkz kl' krho + (if a = b then -1 else 1) * gam kl mul mul' * vkz kl krho * psiD krho

/-- Eq. (3.17): `σ^{↑⋆}_{ℓℓ'2} = -γ_{ℓℓ'} k_ρ k_{ℓz}/k_{ℓ'z} ψ^{↑⋆}_{ℓℓ'}` and
`σ^{↓⋆}_{ℓℓ'2} = γ_{ℓℓ'} k_ρ k_{ℓz}/k_{ℓ'z} ψ^{↓⋆}_{ℓℓ'}`. -/
def sig2 (kl kl' mul mul' : ℝ) (a : Dir) (psiD : ℝ → ℂ) (krho : ℝ) : ℂ :=
  (if a then -1 else 1) * gam kl mul mul' * krho * vkz kl krho / vkz kl' krho * psiD krho

/-- Eq. (3.17): `σ^{∗↓}_{ℓℓ'4} = γ_{ℓℓ'} k_ρ ψ^{∗↓}_{ℓℓ'}` and
`σ^{∗↑}_{ℓℓ'4} = -γ_{ℓℓ'} k_ρ ψ^{∗↑}_{ℓℓ'}`. -/
def sig4 (kl mul mul' : ℝ) (b : Dir) (psiD : ℝ → ℂ) (krho : ℝ) : ℂ :=
  (if b then -1 else 1) * gam kl mul mul' * krho * psiD krho

/-- Eq. (3.17): `σ^{∗⋆}_{ℓℓ'5} = γ_{ℓℓ'} k_ρ²/k_{ℓ'z} ψ^{∗⋆}_{ℓℓ'}`. -/
def sig5 (kl kl' mul mul' : ℝ) (psiD : ℝ → ℂ) (krho : ℝ) : ℂ :=
  gam kl mul mul' * (krho : ℂ) ^ 2 / vkz kl' krho * psiD krho

/-- Section 3.3 (display before eq. (3.28)): `𝒵(k_ρ, z, z') = e^{s (i k_z z - i k'_z z')}` with
`k = k_ℓ`, `k' = k_{ℓ'}`, `k_z = k_{ℓz}`, `k'_z = k_{ℓ'z}` and `s = s^{∗⋆}_{ℓℓ'}`. -/
def calZ (s k k' krho z z' : ℝ) : ℂ :=
  Complex.exp ((s : ℂ) * (Complex.I * vkz k krho * z - Complex.I * vkz k' krho * z'))

/-- Eq. (3.20) (and Section 3.3): `ℰ(r, r') = e^{i k_x (x - x') + i k_y (y - y')} 𝒵(k_ρ, z, z')`,
as a function of `(k_x, k_y)`. -/
def calE (s k k' kx ky : ℝ) (r r' : ℝ × ℝ × ℝ) : ℂ :=
  Complex.exp (Complex.I * ((kx : ℂ) * (r.1 - r'.1) + (ky : ℂ) * (r.2.1 - r'.2.1))) *
    calZ s k k' (krhoOf kx ky) r.2.2 r'.2.2

/-- Integrand of eq. (3.19): `ℰ^{∗⋆}_{ℓℓ'}(τ̂^{∗⋆}_{ℓℓ'}(r), τ̆^⋆_{ℓℓ'}(r')) e^{iκα} σ(k_ρ)` as a
function of `p = (k_x, k_y)`. -/
def opLIntegrand (k : ℕ → ℝ) (d : ℕ → ℝ) (l l' : ℕ) (a b : Dir) (kappa : ℤ) (sigma : ℝ → ℂ)
    (r r' : ℝ × ℝ × ℝ) (p : ℝ × ℝ) : ℂ :=
  calE (sgnS l l' b) (k l) (k l') p.1 p.2 (effLoc d l l' a b r) (polLoc d l l' b r') *
    eia p.1 p.2 ^ kappa * sigma (krhoOf p.1 p.2)

/-- Eq. (3.19): `L^{∗⋆}_{ℓℓ'κ}[σ](r, r') = (i/8π²) ∬_{ℝ²} ℰ^{∗⋆}_{ℓℓ'}(τ̂(r), τ̆(r')) e^{iκα} σ(k_ρ)
dk_x dk_y`. -/
def opL (k : ℕ → ℝ) (d : ℕ → ℝ) (l l' : ℕ) (a b : Dir) (kappa : ℤ) (sigma : ℝ → ℂ)
    (r r' : ℝ × ℝ × ℝ) : ℂ :=
  Complex.I / (8 * (Real.pi : ℂ) ^ 2) * ∫ p : ℝ × ℝ, opLIntegrand k d l l' a b kappa sigma r r' p

/-- Eq. (3.28): `c^{νμ}_{nm} = (s^{∗⋆}_{ℓℓ'})^{n+ν+m+μ} i^{n+ν+1}`. -/
def cCoef (s : ℝ) (n : ℕ) (m : ℤ) (nu : ℕ) (mu : ℤ) : ℂ :=
  (s : ℂ) ^ ((n : ℤ) + (nu : ℤ) + m + mu) * Complex.I ^ (n + nu + 1)

/-- Integrand of eq. (3.28): `ℰ(r, r') e^{i(m-μ+κ)α} P̂_n^m(k_z/k) P̂_ν^μ(k'_z/k') σ(k_ρ)` as a
function of `p = (k_x, k_y)`; `P n m` stands for the analytically extended normalized associated
Legendre function `P̂_n^m`, whose normalization the paper does not state. -/
def intIIntegrand (P : ℕ → ℤ → ℂ → ℂ) (sigma : ℝ → ℂ) (s k k' : ℝ) (n : ℕ) (m kappa : ℤ)
    (nu : ℕ) (mu : ℤ) (r r' : ℝ × ℝ × ℝ) (p : ℝ × ℝ) : ℂ :=
  calE s k k' p.1 p.2 r r' * eia p.1 p.2 ^ (m - mu + kappa) *
    P n m (vkz k (krhoOf p.1 p.2) / k) * P nu mu (vkz k' (krhoOf p.1 p.2) / k') *
      sigma (krhoOf p.1 p.2)

/-- Eq. (3.28): `I^{νμ}_{nmκ}(r, r', σ) = (c^{νμ}_{nm}/2π) ∬_{ℝ²} ℰ(r, r') e^{i(m-μ+κ)α}
P̂_n^m(k_z/k) P̂_ν^μ(k'_z/k') σ(k_ρ) dk_x dk_y`. -/
def intI (P : ℕ → ℤ → ℂ → ℂ) (sigma : ℝ → ℂ) (s k k' : ℝ) (n : ℕ) (m kappa : ℤ) (nu : ℕ)
    (mu : ℤ) (r r' : ℝ × ℝ × ℝ) : ℂ :=
  cCoef s n m nu mu / (2 * (Real.pi : ℂ)) *
    ∫ p : ℝ × ℝ, intIIntegrand P sigma s k k' n m kappa nu mu r r' p

/-- Section 3.4.2: the Bessel function `J_n` of integer order `n`, through the integral
representation `J_n(x) = (2π iⁿ)⁻¹ ∫_0^{2π} e^{i x cos θ + i n θ} dθ` quoted there. -/
def besselJ (n : ℤ) (x : ℝ) : ℂ :=
  (2 * (Real.pi : ℂ) * Complex.I ^ n)⁻¹ *
    ∫ θ in (0 : ℝ)..(2 * Real.pi),
      Complex.exp (Complex.I * (x : ℂ) * (Real.cos θ : ℂ) + Complex.I * (n : ℂ) * (θ : ℂ))

/-- Eq. (3.45): the Sommerfeld-type integral
`Î^{νμ}_{nmκ}(ρ, z, z'; σ) = ∫_0^∞ k_ρ J_{m-μ+κ}(k_ρ ρ) 𝒵(k_ρ, z, z') P̂_n^m(k_z/k)
P̂_ν^μ(k'_z/k') σ(k_ρ) dk_ρ`. -/
def intIhat (P : ℕ → ℤ → ℂ → ℂ) (sigma : ℝ → ℂ) (s k k' : ℝ) (n : ℕ) (m kappa : ℤ) (nu : ℕ)
    (mu : ℤ) (rho z z' : ℝ) : ℂ :=
  ∫ krho in Set.Ioi (0 : ℝ),
    (krho : ℂ) * besselJ (m - mu + kappa) (krho * rho) * calZ s k k' krho z z' *
      P n m (vkz k krho / k) * P nu mu (vkz k' krho / k') * sigma krho

/-- The Chebyshev polynomial of the first kind `T_n`, evaluated at a complex number. -/
def chebT (n : ℕ) (x : ℂ) : ℂ := (Polynomial.Chebyshev.T ℂ (n : ℤ)).eval x

/-- Eq. (A.2): the coefficients `C^{ab}_{js}` of `T_j(a x + b) = Σ_{s=0}^j C^{ab}_{js} T_s(x)` by the
printed recurrence: `C_{00} = 1`, `C_{10} = b`, `C_{21} = 4ab`, `C_{n+1,n+1} = a C_{nn}` (`n ≥ 1`),
`C_{n+1,n} = a C_{n,n-1} + 2b C_{nn}` (`n ≥ 2`),
`C_{n+1,s} = a (C_{n,s-1} + C_{n,s+1}) + 2b C_{ns} - C_{n-1,s}` (`2 ≤ s ≤ n-1`, `n ≥ 3`),
`C_{n+1,1} = 2a C_{n0} + a C_{n2} + 2b C_{n1} - C_{n-1,1}` (`n ≥ 2`),
`C_{n+1,0} = a C_{n1} + 2b C_{n0} - C_{n-1,0}` (`n ≥ 1`), together with the initial value
`C_{11} = a`, which (A.2) uses but does not list, and `C_{js} = 0` for `s > j`. -/
def chebShiftCoeff (a b : ℂ) : ℕ → ℕ → ℂ
  | 0, s => if s = 0 then 1 else 0
  | 1, s => if s = 0 then b else if s = 1 then a else 0
  | n + 2, s =>
    if s = 0 then
      a * chebShiftCoeff a b (n + 1) 1 + 2 * b * chebShiftCoeff a b (n + 1) 0
        - chebShiftCoeff a b n 0
    else if s = 1 then
      (if n = 0 then 4 * a * b
       else 2 * a * chebShiftCoeff a b (n + 1) 0 + a * chebShiftCoeff a b (n + 1) 2
        + 2 * b * chebShiftCoeff a b (n + 1) 1 - chebShiftCoeff a b n 1)
    else if s = n + 2 then a * chebShiftCoeff a b (n + 1) (n + 1)
    else if s = n + 1 then
      a * chebShiftCoeff a b (n + 1) n + 2 * b * chebShiftCoeff a b (n + 1) (n + 1)
    else if s ≤ n then
      a * (chebShiftCoeff a b (n + 1) (s - 1) + chebShiftCoeff a b (n + 1) (s + 1))
        + 2 * b * chebShiftCoeff a b (n + 1) s - chebShiftCoeff a b n s
    else 0

/-- Eq. (3.49): `sgn(x) = (-1)^{min(0, x)}`. -/
def sgnPow (m : ℤ) : ℂ := (-1 : ℂ) ^ (min 0 m)

/-- Eq. (B.1): the prefactor `τ_{nm}(θ)` of the Chebyshev expansion of `P̂_n^m(cos θ)`, `m ≥ 0`:
`1` (`n`, `m` even), `sec θ` (`n` odd, `m` even), `sin θ` (`n`, `m` odd), `tan θ` (`n` even,
`m` odd). -/
def tauLeg (n m : ℕ) (θ : ℂ) : ℂ :=
  if n % 2 = 0 ∧ m % 2 = 0 then 1
  else if m % 2 = 0 then (Complex.cos θ)⁻¹
  else if n % 2 = 1 then Complex.sin θ
  else Complex.tan θ

/-- Eq. (B.1): the number of terms `K_n` of the Chebyshev expansion of `P̂_n^m`, `m ≥ 0`:
`n/2` (`n` even), `(n+1)/2` (`n` odd, `m` even), `(n-1)/2` (`n` odd, `m` odd). -/
def Kn (n m : ℕ) : ℕ :=
  if n % 2 = 0 then n / 2 else if m % 2 = 0 then (n + 1) / 2 else (n - 1) / 2

/-- Section 3.4.1: the closed axis-parallel box of the FMM tree with centre `c` and side length
`h`. -/
def box (c : ℝ × ℝ × ℝ) (h : ℝ) : Set (ℝ × ℝ × ℝ) :=
  {p | |p.1 - c.1| ≤ h / 2 ∧ |p.2.1 - c.2.1| ≤ h / 2 ∧ |p.2.2 - c.2.2| ≤ h / 2}

end Arxiv2507_18491
Source
Yuan, Wang, Zhang and Cai, Fast multipole method for Maxwell's equations in layered media, arXiv:2507.18491v1 (2025), Sections 3.1-3.4 (eqs. (3.1)-(3.24), (3.28), (3.44)-(3.45), (3.49)), Appendix A (eqs. (A.1)-(A.2)) and Appendix B (eq. (B.1))
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Directions (Dir\mathrm{Dir}Dir). A direction is one of two values, true (read as upward, ↑\uparrow↑) or false (read as downward, ↓\downarrow↓). No further structure is attached. Below, a pair of directions (a,b)(a,b)(a,b) is used as a label for a component; aaa is called the "target" direction and bbb the "source" direction.


Wave number (waveNum\mathrm{waveNum}waveNum). Given a real ω\omegaω, two real sequences (εj)j∈N(\varepsilon_j)_{j\in\mathbb N}(εj​)j∈N​, (μj)j∈N(\mu_j)_{j\in\mathbb N}(μj​)j∈N​ and an index ℓ∈N\ell\in\mathbb Nℓ∈N, this is the real number

ω εℓ μℓ.\omega\,\sqrt{\varepsilon_\ell\,\mu_\ell}.ωεℓ​μℓ​​.

Here ⋅\sqrt{\cdot}⋅​ is the real square root, which returns 000 for negative arguments. So the result is 000 whenever εℓμℓ<0\varepsilon_\ell\mu_\ell<0εℓ​μℓ​<0. No sign or positivity condition is imposed on ω\omegaω, ε\varepsilonε or μ\muμ.


Vertical wave number (vkz\mathrm{vkz}vkz). For real numbers kkk and kρk_\rhokρ​, this is the complex number

vkz(k,kρ)={k2−kρ2,kρ2≤k2,i kρ2−k2,kρ2>k2,\mathrm{vkz}(k,k_\rho)=\begin{cases}\sqrt{k^2-k_\rho^2}, & k_\rho^2\le k^2,\\[2pt] i\,\sqrt{k_\rho^2-k^2}, & k_\rho^2>k^2,\end{cases}vkz(k,kρ​)=⎩⎨⎧​k2−kρ2​​,ikρ2​−k2​,​kρ2​≤k2,kρ2​>k2,​

with nonnegative real square roots. It is either a nonnegative real number or iii times a positive real number. It equals 000 exactly when kρ2=k2k_\rho^2=k^2kρ2​=k2. Below it is written kℓz=vkz(kℓ,kρ)k_{\ell z}=\mathrm{vkz}(k_\ell,k_\rho)kℓz​=vkz(kℓ​,kρ​) when k=kℓk=k_\ellk=kℓ​.


Interfaces (IsInterfaces\mathrm{IsInterfaces}IsInterfaces). For L∈NL\in\mathbb NL∈N and a real sequence d=(dj)j∈Nd=(d_j)_{j\in\mathbb N}d=(dj​)j∈N​, this is the proposition that for all natural numbers i<j<Li<j<Li<j<L one has dj<did_j<d_idj​<di​. Equivalently, d0>d1>⋯>dL−1d_0>d_1>\dots>d_{L-1}d0​>d1​>⋯>dL−1​.

  • The values djd_jdj​ for j≥Lj\ge Lj≥L are unconstrained.
  • For L≤1L\le 1L≤1 the condition holds vacuously, for every ddd.

Membership in a layer (InLayer\mathrm{InLayer}InLayer). For L,ℓ∈NL,\ell\in\mathbb NL,ℓ∈N, a real sequence ddd and a real zzz, this is the proposition that all of the following hold:

  • ℓ≤L\ell\le Lℓ≤L;
  • ℓ=0\ell=0ℓ=0 or z<dℓ−1z<d_{\ell-1}z<dℓ−1​;
  • ℓ=L\ell=Lℓ=L or dℓ<zd_\ell<zdℓ​<z.

So for 0<ℓ<L0<\ell<L0<ℓ<L it says dℓ<z<dℓ−1d_\ell<z<d_{\ell-1}dℓ​<z<dℓ−1​. For ℓ=0<L\ell=0<Lℓ=0<L it says only d0<zd_0<zd0​<z. For 0<ℓ=L0<\ell=L0<ℓ=L it says only z<dL−1z<d_{L-1}z<dL−1​.

In the degenerate case L=ℓ=0L=\ell=0L=ℓ=0 it holds for every real zzz. No ordering of ddd is assumed, so the open interval may be empty.


Reflection (refl\mathrm{refl}refl). For a real sequence ddd, an index ℓ\ellℓ and a real zzz,

τℓ(z)=2dℓ−z.\tau_\ell(z)=2d_\ell-z.τℓ​(z)=2dℓ​−z.

Sign (sℓℓ′bs^{b}_{\ell\ell'}sℓℓ′b​, sgnS\mathrm{sgnS}sgnS). For ℓ,ℓ′∈N\ell,\ell'\in\mathbb Nℓ,ℓ′∈N and a direction bbb, this is a real number in {1,−1}\{1,-1\}{1,−1}:

  • if b=↑b=\uparrowb=↑: it is 111 when ℓ<ℓ′\ell<\ell'ℓ<ℓ′ and −1-1−1 when ℓ≥ℓ′\ell\ge\ell'ℓ≥ℓ′;
  • if b=↓b=\downarrowb=↓: it is 111 when ℓ≤ℓ′\ell\le\ell'ℓ≤ℓ′ and −1-1−1 when ℓ>ℓ′\ell>\ell'ℓ>ℓ′.

It does not depend on the target direction.


Component defined (CompDefined\mathrm{CompDefined}CompDefined). For L,ℓ,ℓ′∈NL,\ell,\ell'\in\mathbb NL,ℓ,ℓ′∈N and directions (a,b)(a,b)(a,b), this is the proposition given by the following case split:

  • (↑,↑)(\uparrow,\uparrow)(↑,↑):  ℓ<ℓ′\ \ell<\ell' ℓ<ℓ′, or (ℓ′≥1\ell'\ge1ℓ′≥1 and ℓ+1≤L\ell+1\le Lℓ+1≤L);
  • (↑,↓)(\uparrow,\downarrow)(↑,↓):  (ℓ≤ℓ′\ (\ell\le\ell' (ℓ≤ℓ′ and ℓ′+1≤L)\ell'+1\le L)ℓ′+1≤L), or (ℓ′<ℓ\ell'<\ellℓ′<ℓ and ℓ+1≤L\ell+1\le Lℓ+1≤L);
  • (↓,↑)(\downarrow,\uparrow)(↓,↑):  (ℓ<ℓ′\ (\ell<\ell' (ℓ<ℓ′ and ℓ≥1)\ell\ge1)ℓ≥1), or (ℓ′≤ℓ\ell'\le\ellℓ′≤ℓ and ℓ′≥1\ell'\ge1ℓ′≥1);
  • (↓,↓)(\downarrow,\downarrow)(↓,↓):  (ℓ≤ℓ′\ (\ell\le\ell' (ℓ≤ℓ′ and ℓ≥1\ell\ge1ℓ≥1 and ℓ′+1≤L)\ell'+1\le L)ℓ′+1≤L), or ℓ′<ℓ\ell'<\ellℓ′<ℓ.

It does not require ℓ≤L\ell\le Lℓ≤L or ℓ′≤L\ell'\le Lℓ′≤L.


Exponentials (Zℓℓ′abZ^{ab}_{\ell\ell'}Zℓℓ′ab​, Zfun\mathrm{Zfun}Zfun). The inputs are:

  • real sequences k=(kj)k=(k_j)k=(kj​) and d=(dj)d=(d_j)d=(dj​);
  • indices ℓ,ℓ′\ell,\ell'ℓ,ℓ′ and directions (a,b)(a,b)(a,b);
  • reals kρk_\rhokρ​, zzz, z′z'z′.

The sequence kkk is arbitrary; it is not tied to waveNum\mathrm{waveNum}waveNum. Put kℓz=vkz(kℓ,kρ)k_{\ell z}=\mathrm{vkz}(k_\ell,k_\rho)kℓz​=vkz(kℓ​,kρ​) and kℓ′z=vkz(kℓ′,kρ)k_{\ell' z}=\mathrm{vkz}(k_{\ell'},k_\rho)kℓ′z​=vkz(kℓ′​,kρ​). The value is the complex number

Zℓℓ′ab(kρ,z,z′)={(↑↑):ℓ<ℓ′: ei(kℓzz−kℓ′zz′),else ei(kℓ′zτℓ′−1(z′)−kℓzτℓ(z)),(↑↓):ℓ≤ℓ′: ei(kℓzz−kℓ′zτℓ′(z′)),else ei(kℓ′zz′−kℓzτℓ(z)),(↓↑):ℓ<ℓ′: ei(kℓzτℓ−1(z)−kℓ′zz′),else ei(kℓ′zτℓ′−1(z′)−kℓzz),(↓↓):ℓ≤ℓ′: ei(kℓzτℓ−1(z)−kℓ′zτℓ′(z′)),else ei(kℓ′zz′−kℓzz).Z^{ab}_{\ell\ell'}(k_\rho,z,z')=\begin{cases} (\uparrow\uparrow):& \ell<\ell':\ e^{i(k_{\ell z}z-k_{\ell'z}z')},\quad \text{else } e^{i(k_{\ell'z}\tau_{\ell'-1}(z')-k_{\ell z}\tau_\ell(z))},\\ (\uparrow\downarrow):& \ell\le\ell':\ e^{i(k_{\ell z}z-k_{\ell'z}\tau_{\ell'}(z'))},\quad \text{else } e^{i(k_{\ell'z}z'-k_{\ell z}\tau_\ell(z))},\\ (\downarrow\uparrow):& \ell<\ell':\ e^{i(k_{\ell z}\tau_{\ell-1}(z)-k_{\ell'z}z')},\quad \text{else } e^{i(k_{\ell'z}\tau_{\ell'-1}(z')-k_{\ell z}z)},\\ (\downarrow\downarrow):& \ell\le\ell':\ e^{i(k_{\ell z}\tau_{\ell-1}(z)-k_{\ell'z}\tau_{\ell'}(z'))},\quad \text{else } e^{i(k_{\ell'z}z'-k_{\ell z}z)}. \end{cases}Zℓℓ′ab​(kρ​,z,z′)=⎩⎨⎧​(↑↑):(↑↓):(↓↑):(↓↓):​ℓ<ℓ′: ei(kℓz​z−kℓ′z​z′),else ei(kℓ′z​τℓ′−1​(z′)−kℓz​τℓ​(z)),ℓ≤ℓ′: ei(kℓz​z−kℓ′z​τℓ′​(z′)),else ei(kℓ′z​z′−kℓz​τℓ​(z)),ℓ<ℓ′: ei(kℓz​τℓ−1​(z)−kℓ′z​z′),else ei(kℓ′z​τℓ′−1​(z′)−kℓz​z),ℓ≤ℓ′: ei(kℓz​τℓ−1​(z)−kℓ′z​τℓ′​(z′)),else ei(kℓ′z​z′−kℓz​z).​

Indices ℓ−1\ell-1ℓ−1 and ℓ′−1\ell'-1ℓ′−1 are truncated natural subtraction, so 0−10-10−1 is read as 000 (giving τ0\tau_0τ0​). No layer or definedness hypothesis is imposed.


Effective height (z^\hat zz^, effZ\mathrm{effZ}effZ). For ddd, ℓ\ellℓ, ℓ′\ell'ℓ′, (a,b)(a,b)(a,b) and a real zzz:

  • (↑↑)(\uparrow\uparrow)(↑↑): zzz if ℓ<ℓ′\ell<\ell'ℓ<ℓ′, else τℓ(z)\tau_\ell(z)τℓ​(z);
  • (↑↓)(\uparrow\downarrow)(↑↓): zzz if ℓ≤ℓ′\ell\le\ell'ℓ≤ℓ′, else τℓ(z)\tau_\ell(z)τℓ​(z);
  • (↓↑)(\downarrow\uparrow)(↓↑): τℓ−1(z)\tau_{\ell-1}(z)τℓ−1​(z) if ℓ<ℓ′\ell<\ell'ℓ<ℓ′, else zzz;
  • (↓↓)(\downarrow\downarrow)(↓↓): τℓ−1(z)\tau_{\ell-1}(z)τℓ−1​(z) if ℓ≤ℓ′\ell\le\ell'ℓ≤ℓ′, else zzz.

Here ℓ−1\ell-1ℓ−1 is truncated, with 0−1=00-1=00−1=0.


Polarization height (z˘\breve zz˘, polZ\mathrm{polZ}polZ). For ddd, ℓ\ellℓ, ℓ′\ell'ℓ′, a direction bbb and a real z′z'z′:

  • if b=↑b=\uparrowb=↑: z′z'z′ when ℓ<ℓ′\ell<\ell'ℓ<ℓ′, else τℓ′−1(z′)\tau_{\ell'-1}(z')τℓ′−1​(z′);
  • if b=↓b=\downarrowb=↓: τℓ′(z′)\tau_{\ell'}(z')τℓ′​(z′) when ℓ≤ℓ′\ell\le\ell'ℓ≤ℓ′, else z′z'z′.

Here ℓ′−1\ell'-1ℓ′−1 is truncated, with 0−1=00-1=00−1=0.


Effective location and polarization coordinate (effLoc\mathrm{effLoc}effLoc, polLoc\mathrm{polLoc}polLoc). For points r=(x,y,z)r=(x,y,z)r=(x,y,z) and r′=(x′,y′,z′)r'=(x',y',z')r′=(x′,y′,z′) in R3\mathbb R^3R3:

τ^ℓℓ′ab(r)=(x,y,z^),τ˘ℓℓ′b(r′)=(x′,y′,z˘),\hat\tau^{ab}_{\ell\ell'}(r)=(x,y,\hat z), \qquad \breve\tau^{b}_{\ell\ell'}(r')=(x',y',\breve z),τ^ℓℓ′ab​(r)=(x,y,z^),τ˘ℓℓ′b​(r′)=(x′,y′,z˘),

with z^\hat zz^ and z˘\breve zz˘ the heights defined above. Only the third coordinate changes.


Vertical distance (vertDist\mathrm{vertDist}vertDist). For ddd, ℓ\ellℓ, ℓ′\ell'ℓ′, (a,b)(a,b)(a,b) and reals zzz, z′z'z′:

∣z^ℓℓ′ab(z)−z˘ℓℓ′b(z′)∣.\bigl|\hat z^{ab}_{\ell\ell'}(z)-\breve z^{b}_{\ell\ell'}(z')\bigr|.​z^ℓℓ′ab​(z)−z˘ℓℓ′b​(z′)​.

Matrices J1,…,J5J_1,\dots,J_5J1​,…,J5​. These are 3×33\times33×3 complex matrices; kx,kyk_x,k_ykx​,ky​ are real.

J1=(100010000),J2=(000000001),J3=(00ikx00iky000),J_1=\begin{pmatrix}1&0&0\\0&1&0\\0&0&0\end{pmatrix},\quad J_2=\begin{pmatrix}0&0&0\\0&0&0\\0&0&1\end{pmatrix},\quad J_3=\begin{pmatrix}0&0&ik_x\\0&0&ik_y\\0&0&0\end{pmatrix},J1​=​100​010​000​​,J2​=​000​000​001​​,J3​=​000​000​ikx​iky​0​​, J4=(000000ikxiky0),J5=−(kx2kxky0kxkyky20000).J_4=\begin{pmatrix}0&0&0\\0&0&0\\ik_x&ik_y&0\end{pmatrix},\quad J_5=-\begin{pmatrix}k_x^2&k_xk_y&0\\k_xk_y&k_y^2&0\\0&0&0\end{pmatrix}.J4​=​00ikx​​00iky​​000​​,J5​=−​kx2​kx​ky​0​kx​ky​ky2​0​000​​.

Matrices M1,…,M6M_1,\dots,M_6M1​,…,M6​. These are fixed 3×33\times33×3 complex matrices:

M1=(12000120000), M2=(−14i40i4140000), M3=(−14−i40−i4140000),M_1=\begin{pmatrix}\tfrac12&0&0\\0&\tfrac12&0\\0&0&0\end{pmatrix},\ M_2=\begin{pmatrix}-\tfrac14&\tfrac i4&0\\\tfrac i4&\tfrac14&0\\0&0&0\end{pmatrix},\ M_3=\begin{pmatrix}-\tfrac14&-\tfrac i4&0\\-\tfrac i4&\tfrac14&0\\0&0&0\end{pmatrix},M1​=​21​00​021​0​000​​, M2​=​−41​4i​0​4i​41​0​000​​, M3​=​−41​−4i​0​−4i​41​0​000​​, M4=(001200−i2000), M5=(001200i2000), M6=(000000001).M_4=\begin{pmatrix}0&0&\tfrac12\\0&0&-\tfrac i2\\0&0&0\end{pmatrix},\ M_5=\begin{pmatrix}0&0&\tfrac12\\0&0&\tfrac i2\\0&0&0\end{pmatrix},\ M_6=\begin{pmatrix}0&0&0\\0&0&0\\0&0&1\end{pmatrix}.M4​=​000​000​21​−2i​0​​, M5​=​000​000​21​2i​0​​, M6​=​000​000​001​​.

Radial variable and phase (krhoOf\mathrm{krhoOf}krhoOf, eia\mathrm{eia}eia). For real kx,kyk_x,k_ykx​,ky​:

kρ=kx2+ky2,eiα:=kx+ikykρ.k_\rho=\sqrt{k_x^2+k_y^2}, \qquad e^{i\alpha}:=\frac{k_x+ik_y}{k_\rho}.kρ​=kx2​+ky2​​,eiα:=kρ​kx​+iky​​.

At (kx,ky)=(0,0)(k_x,k_y)=(0,0)(kx​,ky​)=(0,0) the phase is 000, because division by zero gives 000.


Spectral Green's matrix (specGE\mathrm{specGE}specGE). The inputs are:

  • reals ω\omegaω, kℓk_\ellkℓ​, μℓ\mu_\ellμℓ​, kxk_xkx​, kyk_yky​;
  • complex-valued functions φ(z,z′)\varphi(z,z')φ(z,z′), ψ(z,z′)\psi(z,z')ψ(z,z′), ψ~(z,z′)\tilde\psi(z,z')ψ~​(z,z′) of two real variables;
  • reals zzz, z′z'z′.

With kρ2=kx2+ky2k_\rho^2=k_x^2+k_y^2kρ2​=kx2​+ky2​, the value is the 3×33\times33×3 complex matrix

−iωkℓ2(kℓ2φ J1+μℓkρ2ψ J2+μℓ ∂zψ J3+μℓψ~ J4+kℓ2φ+μℓ ∂zψ~kρ2 J5).-\frac{i\omega}{k_\ell^2}\Bigl(k_\ell^2\varphi\,J_1+\mu_\ell k_\rho^2\psi\,J_2+\mu_\ell\,\partial_z\psi\,J_3+\mu_\ell\tilde\psi\,J_4+\frac{k_\ell^2\varphi+\mu_\ell\,\partial_z\tilde\psi}{k_\rho^2}\,J_5\Bigr).−kℓ2​iω​(kℓ2​φJ1​+μℓ​kρ2​ψJ2​+μℓ​∂z​ψJ3​+μℓ​ψ~​J4​+kρ2​kℓ2​φ+μℓ​∂z​ψ~​​J5​).

Conventions and edge cases:

  • All functions are evaluated at (z,z′)(z,z')(z,z′).
  • ∂z\partial_z∂z​ is the derivative in the first argument at zzz, taken to be 000 where that derivative does not exist.
  • If kℓ=0k_\ell=0kℓ​=0 the whole matrix is 000.
  • If kρ=0k_\rho=0kρ​=0 the J5J_5J5​ coefficient is 000.
  • No differentiability, layer or delta term is included.

Reaction part of φ\varphiφ (phiReac\mathrm{phiReac}phiReac). The inputs are:

  • a real ω\omegaω and sequences kkk, ddd;
  • indices ℓ,ℓ′\ell,\ell'ℓ,ℓ′;
  • complex densities φab(kρ)\varphi^{ab}(k_\rho)φab(kρ​) indexed by direction pairs;
  • reals kρk_\rhokρ​, zzz, z′z'z′.

The value is

−(2ω kℓ′z)−1∑a,b∈{↑,↓}φab(kρ) Zℓℓ′ab(kρ,z,z′).-\bigl(2\omega\,k_{\ell'z}\bigr)^{-1}\sum_{a,b\in\{\uparrow,\downarrow\}}\varphi^{ab}(k_\rho)\,Z^{ab}_{\ell\ell'}(k_\rho,z,z').−(2ωkℓ′z​)−1a,b∈{↑,↓}∑​φab(kρ​)Zℓℓ′ab​(kρ​,z,z′).

The inverse of 000 is 000, so the value is 000 if ω=0\omega=0ω=0 or kℓ′z=0k_{\ell'z}=0kℓ′z​=0. All four components are summed regardless of CompDefined\mathrm{CompDefined}CompDefined.


Reaction part of ψ\psiψ (psiReac\mathrm{psiReac}psiReac). Same setting as above, with an additional sequence μ\muμ and densities ψab\psi^{ab}ψab. The value is

−(2ω μℓ′ kℓ′z)−1∑a,bψab(kρ) Zℓℓ′ab(kρ,z,z′).-\bigl(2\omega\,\mu_{\ell'}\,k_{\ell'z}\bigr)^{-1}\sum_{a,b}\psi^{ab}(k_\rho)\,Z^{ab}_{\ell\ell'}(k_\rho,z,z').−(2ωμℓ′​kℓ′z​)−1a,b∑​ψab(kρ​)Zℓℓ′ab​(kρ​,z,z′).

It is 000 if the bracket vanishes.


γ\gammaγ (gam\mathrm{gam}gam). For reals kℓk_\ellkℓ​, μℓ\mu_\ellμℓ​, μℓ′\mu_{\ell'}μℓ′​:

γℓℓ′=μℓμℓ′kℓ2,\gamma_{\ell\ell'}=\frac{\mu_\ell}{\mu_{\ell'}k_\ell^2},γℓℓ′​=μℓ′​kℓ2​μℓ​​,

as a complex number. It is 000 if μℓ′kℓ2=0\mu_{\ell'}k_\ell^2=0μℓ′​kℓ2​=0.


Matrix Θ\ThetaΘ (Theta\mathrm{Theta}Theta). The inputs are reals kℓk_\ellkℓ​, kℓ′k_{\ell'}kℓ′​, μℓ\mu_\ellμℓ​, μℓ′\mu_{\ell'}μℓ′​, directions (a,b)(a,b)(a,b), complex numbers φ\varphiφ, ψ\psiψ, and reals kxk_xkx​, kyk_yky​. Set

  • kρ=kx2+ky2k_\rho=\sqrt{k_x^2+k_y^2}kρ​=kx2​+ky2​​;
  • kℓz=vkz(kℓ,kρ)k_{\ell z}=\mathrm{vkz}(k_\ell,k_\rho)kℓz​=vkz(kℓ​,kρ​) and kℓ′z=vkz(kℓ′,kρ)k_{\ell'z}=\mathrm{vkz}(k_{\ell'},k_\rho)kℓ′z​=vkz(kℓ′​,kρ​);
  • signs (c3,c4,c5)(c_3,c_4,c_5)(c3​,c4​,c5​) equal to (1,−1,1)(1,-1,1)(1,−1,1) for ↑↓\uparrow\downarrow↑↓, (1,1,−1)(1,1,-1)(1,1,−1) for ↑↑\uparrow\uparrow↑↑, (−1,−1,−1)(-1,-1,-1)(−1,−1,−1) for ↓↓\downarrow\downarrow↓↓, and (−1,1,1)(-1,1,1)(−1,1,1) for ↓↑\downarrow\uparrow↓↑.

The value is

Θ=φ(J1+1kρ2J5)+γℓℓ′ψ(kρ2J2+c3 ikℓzJ3+c4 ikℓ′zJ4+c5kℓzkℓ′zkρ2J5).\Theta=\varphi\Bigl(J_1+\frac{1}{k_\rho^2}J_5\Bigr)+\gamma_{\ell\ell'}\psi\Bigl(k_\rho^2J_2+c_3\,ik_{\ell z}J_3+c_4\,ik_{\ell'z}J_4+c_5\frac{k_{\ell z}k_{\ell'z}}{k_\rho^2}J_5\Bigr).Θ=φ(J1​+kρ2​1​J5​)+γℓℓ′​ψ(kρ2​J2​+c3​ikℓz​J3​+c4​ikℓ′z​J4​+c5​kρ2​kℓz​kℓ′z​​J5​).

At kρ=0k_\rho=0kρ​=0, both 1/kρ21/k_\rho^21/kρ2​ factors are 000.


Spectral reaction component (G^\hat GG^, GhatReac\mathrm{GhatReac}GhatReac). The inputs are:

  • sequences kkk, μ\muμ, ddd;
  • indices ℓ,ℓ′\ell,\ell'ℓ,ℓ′ and directions (a,b)(a,b)(a,b);
  • density functions φ(⋅)\varphi(\cdot)φ(⋅), ψ(⋅)\psi(\cdot)ψ(⋅) of kρk_\rhokρ​;
  • reals kxk_xkx​, kyk_yky​, zzz, z′z'z′.

With kρ=kx2+ky2k_\rho=\sqrt{k_x^2+k_y^2}kρ​=kx2​+ky2​​, the value is the 3×33\times33×3 complex matrix

G^ℓℓ′ab=i Zℓℓ′ab(kρ,z,z′)2 kℓ′z  Θ(kℓ,kℓ′,μℓ,μℓ′,a,b,φ(kρ),ψ(kρ),kx,ky).\hat G^{ab}_{\ell\ell'}=\frac{i\,Z^{ab}_{\ell\ell'}(k_\rho,z,z')}{2\,k_{\ell'z}}\;\Theta\bigl(k_\ell,k_{\ell'},\mu_\ell,\mu_{\ell'},a,b,\varphi(k_\rho),\psi(k_\rho),k_x,k_y\bigr).G^ℓℓ′ab​=2kℓ′z​iZℓℓ′ab​(kρ​,z,z′)​Θ(kℓ​,kℓ′​,μℓ​,μℓ′​,a,b,φ(kρ​),ψ(kρ​),kx​,ky​).

The scalar prefactor is 000 when kℓ′z=0k_{\ell'z}=0kℓ′z​=0.


Physical reaction component (GReac\mathrm{GReac}GReac). For the same data, points r=(x,y,z)r=(x,y,z)r=(x,y,z) and r′=(x′,y′,z′)r'=(x',y',z')r′=(x′,y′,z′), and matrix indices i,j∈{0,1,2}i,j\in\{0,1,2\}i,j∈{0,1,2}, the value is

14π2∫R2(G^ℓℓ′ab)ij(kx,ky,z,z′) ei(kx(x−x′)+ky(y−y′)) dkx dky.\frac{1}{4\pi^2}\int_{\mathbb R^2}\bigl(\hat G^{ab}_{\ell\ell'}\bigr)_{ij}(k_x,k_y,z,z')\,e^{i(k_x(x-x')+k_y(y-y'))}\,dk_x\,dk_y.4π21​∫R2​(G^ℓℓ′ab​)ij​(kx​,ky​,z,z′)ei(kx​(x−x′)+ky​(y−y′))dkx​dky​.

This is the Lebesgue integral over the plane, which is defined to be 000 when the integrand is not integrable.


σ1\sigma_1σ1​ (sig1\mathrm{sig1}sig1). For reals kℓk_\ellkℓ​, kℓ′k_{\ell'}kℓ′​, μℓ\mu_\ellμℓ​, μℓ′\mu_{\ell'}μℓ′​, directions (a,b)(a,b)(a,b), functions φ\varphiφ, ψ\psiψ and a real kρk_\rhokρ​:

φ(kρ)kℓ′z+ϵ γℓℓ′ kℓz ψ(kρ),ϵ={+1a=b,−1a≠b.\frac{\varphi(k_\rho)}{k_{\ell'z}}+\epsilon\,\gamma_{\ell\ell'}\,k_{\ell z}\,\psi(k_\rho), \qquad \epsilon=\begin{cases}+1 & a=b,\\ -1 & a\ne b.\end{cases}kℓ′z​φ(kρ​)​+ϵγℓℓ′​kℓz​ψ(kρ​),ϵ={+1−1​a=b,a=b.​

The first term is 000 if kℓ′z=0k_{\ell'z}=0kℓ′z​=0.


σ3\sigma_3σ3​ as printed (sig3\mathrm{sig3}sig3). Same formula and inputs as σ1\sigma_1σ1​, except that it depends only on bbb:

ϵ={−1b=↑,+1b=↓.\epsilon=\begin{cases}-1 & b=\uparrow,\\ +1 & b=\downarrow.\end{cases}ϵ={−1+1​b=↑,b=↓.​

σ3\sigma_3σ3​ corrected (sig3c\mathrm{sig3c}sig3c). Same formula and inputs as σ1\sigma_1σ1​, with

ϵ={−1a=b,+1a≠b.\epsilon=\begin{cases}-1 & a=b,\\ +1 & a\ne b.\end{cases}ϵ={−1+1​a=b,a=b.​

σ2\sigma_2σ2​ (sig2\mathrm{sig2}sig2). For a direction aaa and the same other inputs:

ϵ γℓℓ′ kρ kℓzkℓ′z ψ(kρ),ϵ={−1a=↑,+1a=↓.\epsilon\,\gamma_{\ell\ell'}\,k_\rho\,\frac{k_{\ell z}}{k_{\ell'z}}\,\psi(k_\rho), \qquad \epsilon=\begin{cases}-1 & a=\uparrow,\\ +1 & a=\downarrow.\end{cases}ϵγℓℓ′​kρ​kℓ′z​kℓz​​ψ(kρ​),ϵ={−1+1​a=↑,a=↓.​

It is 000 if kℓ′z=0k_{\ell'z}=0kℓ′z​=0.


σ4\sigma_4σ4​ (sig4\mathrm{sig4}sig4). For a direction bbb:

ϵ γℓℓ′ kρ ψ(kρ),ϵ={−1b=↑,+1b=↓.\epsilon\,\gamma_{\ell\ell'}\,k_\rho\,\psi(k_\rho), \qquad \epsilon=\begin{cases}-1 & b=\uparrow,\\ +1 & b=\downarrow.\end{cases}ϵγℓℓ′​kρ​ψ(kρ​),ϵ={−1+1​b=↑,b=↓.​

σ5\sigma_5σ5​ (sig5\mathrm{sig5}sig5). The value is

γℓℓ′ kρ2kℓ′z ψ(kρ).\gamma_{\ell\ell'}\,\frac{k_\rho^2}{k_{\ell'z}}\,\psi(k_\rho).γℓℓ′​kℓ′z​kρ2​​ψ(kρ​).

It is 000 if kℓ′z=0k_{\ell'z}=0kℓ′z​=0.


Z\mathcal ZZ (calZ\mathrm{calZ}calZ). For reals sss, kkk, k′k'k′, kρk_\rhokρ​, zzz, z′z'z′, with kz=vkz(k,kρ)k_z=\mathrm{vkz}(k,k_\rho)kz​=vkz(k,kρ​) and kz′=vkz(k′,kρ)k'_z=\mathrm{vkz}(k',k_\rho)kz′​=vkz(k′,kρ​):

Z(kρ,z,z′)=e s (ikzz−ikz′z′).\mathcal Z(k_\rho,z,z')=e^{\,s\,(ik_zz-ik'_zz')}.Z(kρ​,z,z′)=es(ikz​z−ikz′​z′).

Here sss is an arbitrary real number, not restricted to ±1\pm1±1.


E\mathcal EE (calE\mathrm{calE}calE). For reals sss, kkk, k′k'k′, kxk_xkx​, kyk_yky​ and points r=(x,y,z)r=(x,y,z)r=(x,y,z), r′=(x′,y′,z′)r'=(x',y',z')r′=(x′,y′,z′):

E=ei(kx(x−x′)+ky(y−y′)) Z(kx2+ky2, z, z′).\mathcal E=e^{i(k_x(x-x')+k_y(y-y'))}\,\mathcal Z\Bigl(\sqrt{k_x^2+k_y^2},\,z,\,z'\Bigr).E=ei(kx​(x−x′)+ky​(y−y′))Z(kx2​+ky2​​,z,z′).

Integrand of LLL (opLIntegrand\mathrm{opLIntegrand}opLIntegrand). The inputs are:

  • sequences kkk, ddd;
  • indices ℓ,ℓ′\ell,\ell'ℓ,ℓ′ and directions (a,b)(a,b)(a,b);
  • an integer κ\kappaκ and a function σ:R→C\sigma:\mathbb R\to\mathbb Cσ:R→C;
  • points rrr, r′r'r′ and p=(kx,ky)p=(k_x,k_y)p=(kx​,ky​).

The value is

E(with s=sℓℓ′b, k=kℓ, k′=kℓ′)(τ^ℓℓ′ab(r),τ˘ℓℓ′b(r′))⋅(eiα)κ⋅σ(kρ).\mathcal E\bigl(\text{with } s=s^{b}_{\ell\ell'},\ k=k_\ell,\ k'=k_{\ell'}\bigr)\bigl(\hat\tau^{ab}_{\ell\ell'}(r),\breve\tau^{b}_{\ell\ell'}(r')\bigr)\cdot\bigl(e^{i\alpha}\bigr)^{\kappa}\cdot\sigma(k_\rho).E(with s=sℓℓ′b​, k=kℓ​, k′=kℓ′​)(τ^ℓℓ′ab​(r),τ˘ℓℓ′b​(r′))⋅(eiα)κ⋅σ(kρ​).

At p=0p=0p=0, eiα=0e^{i\alpha}=0eiα=0, so the power is 111 if κ=0\kappa=0κ=0 and 000 otherwise.


Operator LLL (opL\mathrm{opL}opL). The value is

Lℓℓ′κab[σ](r,r′)=i8π2∫R2(integrand above) dkx dky.L^{ab}_{\ell\ell'\kappa}[\sigma](r,r')=\frac{i}{8\pi^2}\int_{\mathbb R^2}(\text{integrand above})\,dk_x\,dk_y.Lℓℓ′κab​[σ](r,r′)=8π2i​∫R2​(integrand above)dkx​dky​.

This is a Lebesgue integral, set to 000 if the integrand is not integrable.


Coefficient ccc (cCoef\mathrm{cCoef}cCoef). For a real sss, naturals nnn, ν\nuν and integers mmm, μ\muμ:

cnmνμ=s n+ν+m+μ  i n+ν+1.c^{\nu\mu}_{nm}=s^{\,n+\nu+m+\mu}\;i^{\,n+\nu+1}.cnmνμ​=sn+ν+m+μin+ν+1.

The first power has an integer exponent. For s=0s=0s=0 it gives 111 if the exponent is 000, and 000 if the exponent is nonzero (positive or negative).


Integrand of III (intIIntegrand\mathrm{intIIntegrand}intIIntegrand). The inputs are:

  • an arbitrary function P(n,m,w)P(n,m,w)P(n,m,w) of n∈Nn\in\mathbb Nn∈N, m∈Zm\in\mathbb Zm∈Z and w∈Cw\in\mathbb Cw∈C, written P^nm(w)\hat P_n^m(w)P^nm​(w);
  • σ:R→C\sigma:\mathbb R\to\mathbb Cσ:R→C;
  • reals sss, kkk, k′k'k′;
  • n,ν∈Nn,\nu\in\mathbb Nn,ν∈N and m,κ,μ∈Zm,\kappa,\mu\in\mathbb Zm,κ,μ∈Z;
  • points rrr, r′r'r′ and p=(kx,ky)p=(k_x,k_y)p=(kx​,ky​).

The value is

E⋅(eiα)m−μ+κ⋅P^nm ⁣(kzk)⋅P^νμ ⁣(kz′k′)⋅σ(kρ),\mathcal E\cdot\bigl(e^{i\alpha}\bigr)^{m-\mu+\kappa}\cdot\hat P_n^m\!\Bigl(\frac{k_z}{k}\Bigr)\cdot\hat P_\nu^\mu\!\Bigl(\frac{k'_z}{k'}\Bigr)\cdot\sigma(k_\rho),E⋅(eiα)m−μ+κ⋅P^nm​(kkz​​)⋅P^νμ​(k′kz′​​)⋅σ(kρ​),

with E\mathcal EE formed from (s,k,k′,kx,ky,r,r′)(s,k,k',k_x,k_y,r,r')(s,k,k′,kx​,ky​,r,r′) and kzk_zkz​, kz′k'_zkz′​ as in Z\mathcal ZZ. The function PPP is not required to be a Legendre function. A quotient by k=0k=0k=0 (or k′=0k'=0k′=0) is 000.


Integral III (intI\mathrm{intI}intI). The value is

Inmκνμ=cnmνμ2π∫R2(integrand above) dkx dky.I^{\nu\mu}_{nm\kappa}=\frac{c^{\nu\mu}_{nm}}{2\pi}\int_{\mathbb R^2}(\text{integrand above})\,dk_x\,dk_y.Inmκνμ​=2πcnmνμ​​∫R2​(integrand above)dkx​dky​.

Here ccc is built from the same sss, and the integral is 000 if the integrand is not integrable.


Bessel function (besselJ\mathrm{besselJ}besselJ). For an integer nnn and a real xxx:

Jn(x)=12π in∫02πe ixcos⁡θ+inθ dθ.J_n(x)=\frac{1}{2\pi\,i^{n}}\int_0^{2\pi}e^{\,ix\cos\theta+in\theta}\,d\theta.Jn​(x)=2πin1​∫02π​eixcosθ+inθdθ.

Integral I^\hat II^ (intIhat\mathrm{intIhat}intIhat). With the same PPP, σ\sigmaσ, sss, kkk, k′k'k′, nnn, mmm, κ\kappaκ, ν\nuν, μ\muμ and reals ρ\rhoρ, zzz, z′z'z′:

I^nmκνμ(ρ,z,z′;σ)=∫(0,∞)kρ Jm−μ+κ(kρρ) Z(kρ,z,z′) P^nm ⁣(kzk) P^νμ ⁣(kz′k′) σ(kρ) dkρ.\hat I^{\nu\mu}_{nm\kappa}(\rho,z,z';\sigma)=\int_{(0,\infty)}k_\rho\,J_{m-\mu+\kappa}(k_\rho\rho)\,\mathcal Z(k_\rho,z,z')\,\hat P_n^m\!\Bigl(\frac{k_z}{k}\Bigr)\,\hat P_\nu^\mu\!\Bigl(\frac{k'_z}{k'}\Bigr)\,\sigma(k_\rho)\,dk_\rho.I^nmκνμ​(ρ,z,z′;σ)=∫(0,∞)​kρ​Jm−μ+κ​(kρ​ρ)Z(kρ​,z,z′)P^nm​(kkz​​)P^νμ​(k′kz′​​)σ(kρ​)dkρ​.

This is a Lebesgue integral, set to 000 if the integrand is not integrable.


Chebyshev polynomial (chebT\mathrm{chebT}chebT). For n∈Nn\in\mathbb Nn∈N and x∈Cx\in\mathbb Cx∈C, the value is Tn(x)T_n(x)Tn​(x), the Chebyshev polynomial of the first kind evaluated at xxx.


Chebyshev shift coefficients (CjsabC^{ab}_{js}Cjsab​, chebShiftCoeff\mathrm{chebShiftCoeff}chebShiftCoeff). For complex aaa, bbb and naturals jjj, sss, the coefficients are defined by recursion on jjj.

Initial rows:

  • C0,0=1C_{0,0}=1C0,0​=1 and C0,s=0C_{0,s}=0C0,s​=0 for s≥1s\ge1s≥1;
  • C1,0=bC_{1,0}=bC1,0​=b, C1,1=aC_{1,1}=aC1,1​=a and C1,s=0C_{1,s}=0C1,s​=0 for s≥2s\ge2s≥2.

For j≥2j\ge2j≥2:

Cj,0=a Cj−1,1+2b Cj−1,0−Cj−2,0,C2,1=4ab,Cj,1=2a Cj−1,0+a Cj−1,2+2b Cj−1,1−Cj−2,1(j≥3),Cj,j=a Cj−1,j−1,Cj,j−1=a Cj−1,j−2+2b Cj−1,j−1(j≥3),Cj,s=a (Cj−1,s−1+Cj−1,s+1)+2b Cj−1,s−Cj−2,s(2≤s≤j−2),Cj,s=0(s>j).\begin{aligned} C_{j,0}&=a\,C_{j-1,1}+2b\,C_{j-1,0}-C_{j-2,0},\\ C_{2,1}&=4ab,\\ C_{j,1}&=2a\,C_{j-1,0}+a\,C_{j-1,2}+2b\,C_{j-1,1}-C_{j-2,1}\quad(j\ge3),\\ C_{j,j}&=a\,C_{j-1,j-1},\\ C_{j,j-1}&=a\,C_{j-1,j-2}+2b\,C_{j-1,j-1}\quad(j\ge3),\\ C_{j,s}&=a\,(C_{j-1,s-1}+C_{j-1,s+1})+2b\,C_{j-1,s}-C_{j-2,s}\quad(2\le s\le j-2),\\ C_{j,s}&=0\quad(s>j). \end{aligned}Cj,0​C2,1​Cj,1​Cj,j​Cj,j−1​Cj,s​Cj,s​​=aCj−1,1​+2bCj−1,0​−Cj−2,0​,=4ab,=2aCj−1,0​+aCj−1,2​+2bCj−1,1​−Cj−2,1​(j≥3),=aCj−1,j−1​,=aCj−1,j−2​+2bCj−1,j−1​(j≥3),=a(Cj−1,s−1​+Cj−1,s+1​)+2bCj−1,s​−Cj−2,s​(2≤s≤j−2),=0(s>j).​

This is a definition only. No relation to Tj(ax+b)T_j(ax+b)Tj​(ax+b) is asserted.


Sign power (sgnPow\mathrm{sgnPow}sgnPow). For an integer mmm, the value is (−1)min⁡(0,m)(-1)^{\min(0,m)}(−1)min(0,m). This equals 111 for m≥0m\ge0m≥0 and (−1)m(-1)^m(−1)m for m<0m<0m<0.


Prefactor τnm\tau_{nm}τnm​ (tauLeg\mathrm{tauLeg}tauLeg). For naturals nnn, mmm and a complex θ\thetaθ:

τnm(θ)={1,n,m even,1/cos⁡θ,n odd, m even,sin⁡θ,n,m odd,tan⁡θ,n even, m odd.\tau_{nm}(\theta)=\begin{cases}1,& n,m\text{ even},\\ 1/\cos\theta,& n\text{ odd},\ m\text{ even},\\ \sin\theta,& n,m\text{ odd},\\ \tan\theta,& n\text{ even},\ m\text{ odd}.\end{cases}τnm​(θ)=⎩⎨⎧​1,1/cosθ,sinθ,tanθ,​n,m even,n odd, m even,n,m odd,n even, m odd.​

Where cos⁡θ=0\cos\theta=0cosθ=0, both 1/cos⁡θ1/\cos\theta1/cosθ and tan⁡θ=sin⁡θ/cos⁡θ\tan\theta=\sin\theta/\cos\thetatanθ=sinθ/cosθ take the value 000.


Term count KnK_nKn​ (Kn\mathrm{Kn}Kn). For naturals nnn, mmm:

Kn={n/2,n even,(n+1)/2,n odd, m even,(n−1)/2,n odd, m odd.K_n=\begin{cases}n/2,& n\text{ even},\\ (n+1)/2,& n\text{ odd},\ m\text{ even},\\ (n-1)/2,& n\text{ odd},\ m\text{ odd}.\end{cases}Kn​=⎩⎨⎧​n/2,(n+1)/2,(n−1)/2,​n even,n odd, m even,n odd, m odd.​

All of these are exact natural numbers.


Box (box\mathrm{box}box). For a centre c=(c1,c2,c3)∈R3c=(c_1,c_2,c_3)\in\mathbb R^3c=(c1​,c2​,c3​)∈R3 and a real hhh, this is the set

{p∈R3:∣p1−c1∣≤h/2, ∣p2−c2∣≤h/2, ∣p3−c3∣≤h/2}.\{p\in\mathbb R^3: |p_1-c_1|\le h/2,\ |p_2-c_2|\le h/2,\ |p_3-c_3|\le h/2\}.{p∈R3:∣p1​−c1​∣≤h/2, ∣p2​−c2​∣≤h/2, ∣p3​−c3​∣≤h/2}.

It is empty if h<0h<0h<0 and equals {c}\{c\}{c} if h=0h=0h=0.

Human review
  • Endorsed by Shuze Chen · Nov 26, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 26, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me