Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Random scattering matrices of particle slabs: modes, normalized blocks, ensemble, phases and cascades

Definition
Arxiv2205_09423_Basic

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

disordered-mediapolarizationrandom-matricesscattering-matrixtransfer-matrix

Objects of Section 2 and Appendices A–D of Byrnes and Foreman (2022).

  1. Modes (Section 2.1). A mode set consists of a wavenumber k=2π/λ>0k=2\pi/\lambda>0k=2π/λ>0 and 2Nk+12N_k+12Nk​+1 distinct transverse wavevectors κi=(kix,kiy)\boldsymbol\kappa_i=(k_{ix},k_{iy})κi​=(kix​,kiy​), i=−Nk,…,Nki=-N_k,\dots,N_ki=−Nk​,…,Nk​, with ∣κi∣<k|\boldsymbol\kappa_i|<k∣κi​∣<k and κ−i=−κi\boldsymbol\kappa_{-i}=-\boldsymbol\kappa_iκ−i​=−κi​ (so κ0=0\boldsymbol\kappa_0=\mathbf 0κ0​=0), each with the cubature weight w=πk2/(2Nk+1)w=\pi k^2/(2N_k+1)w=πk2/(2Nk​+1). Write kiz=(k2−kix2−kiy2)1/2>0k_{iz}=(k^2-k_{ix}^2-k_{iy}^2)^{1/2}>0kiz​=(k2−kix2​−kiy2​)1/2>0, ki=(kix,kiy,kiz)\mathbf k_i=(k_{ix},k_{iy},k_{iz})ki​=(kix​,kiy​,kiz​), k~i=(kix,kiy,−kiz)\widetilde{\mathbf k}_i=(k_{ix},k_{iy},-k_{iz})ki​=(kix​,kiy​,−kiz​), ui=ki/k\mathbf u_i=\mathbf k_i/kui​=ki​/k, u~i=k~i/k\widetilde{\mathbf u}_i=\widetilde{\mathbf k}_i/kui​=ki​/k, and
Cji=w2πkkjzkiz,Cijuv=wnΔLk2kizkjzkuzkvz.C_{ji}=\frac{w}{2\pi k\sqrt{k_{jz}k_{iz}}},\qquad C_{ijuv}=\frac{wn\Delta L}{k^2\sqrt{k_{iz}k_{jz}k_{uz}k_{vz}}}.Cji​=2πkkjz​kiz​​w​,Cijuv​=k2kiz​kjz​kuz​kvz​​wnΔL​.

δijuvR=1\delta^R_{ijuv}=1δijuvR​=1 if κi−κj=κu−κv\boldsymbol\kappa_i-\boldsymbol\kappa_j=\boldsymbol\kappa_u-\boldsymbol\kappa_vκi​−κj​=κu​−κv​ and 000 otherwise; δijuvP=1\delta^P_{ijuv}=1δijuvP​=1 if κi−κj=−(κu−κv)\boldsymbol\kappa_i-\boldsymbol\kappa_j=-(\boldsymbol\kappa_u-\boldsymbol\kappa_v)κi​−κj​=−(κu​−κv​) and 000 otherwise. 2. Polar basis (Eq. 11). For a unit direction ek\mathbf e_kek​: eϕ=z^×ek/∣z^×ek∣\mathbf e_\phi=\hat{\mathbf z}\times\mathbf e_k/|\hat{\mathbf z}\times\mathbf e_k|eϕ​=z^×ek​/∣z^×ek​∣ (eϕ=±y^\mathbf e_\phi=\pm\hat{\mathbf y}eϕ​=±y^​ if ek=±z^\mathbf e_k=\pm\hat{\mathbf z}ek​=±z^) and eθ=eϕ×ek/∣eϕ×ek∣\mathbf e_\theta=\mathbf e_\phi\times\mathbf e_k/|\mathbf e_\phi\times\mathbf e_k|eθ​=eϕ​×ek​/∣eϕ​×ek​∣. The reduction of a complex 3×33\times33×3 matrix XXX from direction uin\mathbf u_{\rm in}uin​ to direction uout\mathbf u_{\rm out}uout​ is the 2×22\times22×2 matrix [em(uout)TX en(uin)]m,n∈{θ,ϕ}[\mathbf e_m(\mathbf u_{\rm out})^{\mathrm T}X\,\mathbf e_n(\mathbf u_{\rm in})]_{m,n\in\{\theta,\phi\}}[em​(uout​)TXen​(uin​)]m,n∈{θ,ϕ}​. 3. Slab (Eqs. 9–17). A slab contains NNN particles with centres rp\mathbf r_prp​ and far-field amplitude matrices Ap(uout,uin)\mathbf A_p(\mathbf u_{\rm out},\mathbf u_{\rm in})Ap​(uout​,uin​) (complex 3×33\times33×3). Its discretized transmission and reflection matrices are t(κj,κi)=δijwI3+12πkkjz∑pAp(uj,ui)ei(ki−kj)⋅rp\mathbf t(\boldsymbol\kappa_j,\boldsymbol\kappa_i)=\frac{\delta_{ij}}{w}\mathbb I_3+\frac{1}{2\pi kk_{jz}}\sum_p\mathbf A_p(\mathbf u_j,\mathbf u_i)e^{i(\mathbf k_i-\mathbf k_j)\cdot\mathbf r_p}t(κj​,κi​)=wδij​​I3​+2πkkjz​1​∑p​Ap​(uj​,ui​)ei(ki​−kj​)⋅rp​ and r(κj,κi)=12πkkjz∑pAp(u~j,ui)ei(ki−k~j)⋅rp\mathbf r(\boldsymbol\kappa_j,\boldsymbol\kappa_i)=\frac{1}{2\pi kk_{jz}}\sum_p\mathbf A_p(\widetilde{\mathbf u}_j,\mathbf u_i)e^{i(\mathbf k_i-\widetilde{\mathbf k}_j)\cdot\mathbf r_p}r(κj​,κi​)=2πkkjz​1​∑p​Ap​(uj​,ui​)ei(ki​−kj​)⋅rp​; t(j,i)\mathbf t_{(j,i)}t(j,i)​, r(j,i)\mathbf r_{(j,i)}r(j,i)​ are their reductions (Eqs. 12–13), and kjz/kiz t(j,i)w\sqrt{k_{jz}/k_{iz}}\,\mathbf t_{(j,i)}wkjz​/kiz​​t(j,i)​w, kjz/kiz r(j,i)w\sqrt{k_{jz}/k_{iz}}\,\mathbf r_{(j,i)}wkjz​/kiz​​r(j,i)​w their normalizations. The normalized blocks are

tˉ(j,i)=δijI2+Cji∑pAp(j,i)tei(ki−kj)⋅rp,rˉ(j,i)=Cji∑pAp(j,i)rei(ki−k~j)⋅rp,\bar{\mathbf t}_{(j,i)}=\delta_{ij}\mathbb I_2+C_{ji}\sum_p\mathbf A^t_{p(j,i)}e^{i(\mathbf k_i-\mathbf k_j)\cdot\mathbf r_p},\qquad \bar{\mathbf r}_{(j,i)}=C_{ji}\sum_p\mathbf A^r_{p(j,i)}e^{i(\mathbf k_i-\widetilde{\mathbf k}_j)\cdot\mathbf r_p},tˉ(j,i)​=δij​I2​+Cji​p∑​Ap(j,i)t​ei(ki​−kj​)⋅rp​,rˉ(j,i)​=Cji​p∑​Ap(j,i)r​ei(ki​−kj​)⋅rp​,

with Ap(j,i)t\mathbf A^t_{p(j,i)}Ap(j,i)t​, Ap(j,i)r\mathbf A^r_{p(j,i)}Ap(j,i)r​ the reductions of Ap(uj,ui)\mathbf A_p(\mathbf u_j,\mathbf u_i)Ap​(uj​,ui​) and Ap(u~j,ui)\mathbf A_p(\widetilde{\mathbf u}_j,\mathbf u_i)Ap​(uj​,ui​). For incidence from the right, tˉ(j,i)′=δijI2+Cji∑pAp(j,i)t′ei(k~i−k~j)⋅rp\bar{\mathbf t}'_{(j,i)}=\delta_{ij}\mathbb I_2+C_{ji}\sum_p\mathbf A^{t'}_{p(j,i)}e^{i(\widetilde{\mathbf k}_i-\widetilde{\mathbf k}_j)\cdot\mathbf r_p}tˉ(j,i)′​=δij​I2​+Cji​∑p​Ap(j,i)t′​ei(ki​−kj​)⋅rp​ and rˉ(j,i)′=Cji∑pAp(j,i)r′ei(k~i−kj)⋅rp\bar{\mathbf r}'_{(j,i)}=C_{ji}\sum_p\mathbf A^{r'}_{p(j,i)}e^{i(\widetilde{\mathbf k}_i-\mathbf k_j)\cdot\mathbf r_p}rˉ(j,i)′​=Cji​∑p​Ap(j,i)r′​ei(ki​−kj​)⋅rp​, with incident direction u~i\widetilde{\mathbf u}_iui​ and outgoing directions u~j\widetilde{\mathbf u}_juj​, uj\mathbf u_juj​. The blocks are assembled as in Eq. (16) (block row jjj, block column iii) and Sˉ=(rˉtˉ′tˉrˉ′)\bar{\mathbf S}=\begin{pmatrix}\bar{\mathbf r}&\bar{\mathbf t}'\\\bar{\mathbf t}&\bar{\mathbf r}'\end{pmatrix}Sˉ=(rˉtˉ​tˉ′rˉ′​). 4. Ensemble (Section 2.2). On a probability space, the pairs (rp,Ap)(\mathbf r_p,\mathbf A_p)(rp​,Ap​) are independent across particles, rp\mathbf r_prp​ is independent of Ap\mathbf A_pAp​, the Ap\mathbf A_pAp​ are identically distributed with square-integrable entries, the zzz coordinate of rp\mathbf r_prp​ is uniform on [−ΔL/2,ΔL/2][-\Delta L/2,\Delta L/2][−ΔL/2,ΔL/2] and independent of the transverse position ρp\boldsymbol\rho_pρp​, ΔL>0\Delta L>0ΔL>0, n>0n>0n>0, and for every q=κi−κj−κu+κv\mathbf q=\boldsymbol\kappa_i-\boldsymbol\kappa_j-\boldsymbol\kappa_u+\boldsymbol\kappa_vq=κi​−κj​−κu​+κv​

N⟨eiq⋅ρp⟩=(2π)2nΔLw δq,0.N\langle e^{i\mathbf q\cdot\boldsymbol\rho_p}\rangle=\frac{(2\pi)^2n\Delta L}{w}\,\delta_{\mathbf q,\mathbf 0}.N⟨eiq⋅ρp​⟩=w(2π)2nΔL​δq,0​.

Covariance: cov⁡(X,Y)=⟨XY∗⟩−⟨X⟩⟨Y⟩∗\operatorname{cov}(X,Y)=\langle XY^*\rangle-\langle X\rangle\langle Y\rangle^*cov(X,Y)=⟨XY∗⟩−⟨X⟩⟨Y⟩∗; pseudo-covariance: pcov⁡(X,Y)=⟨XY⟩−⟨X⟩⟨Y⟩\operatorname{pcov}(X,Y)=\langle XY\rangle-\langle X\rangle\langle Y\ranglepcov(X,Y)=⟨XY⟩−⟨X⟩⟨Y⟩. sinc⁡x=sin⁡x/x\operatorname{sinc}x=\sin x/xsincx=sinx/x, sinc⁡0=1\operatorname{sinc}0=1sinc0=1. 5. Position and cascades (Section 2.3, Appendices B, C). Translating every particle by L0z^L_0\hat{\mathbf z}L0​z^ moves the slab centre to L0L_0L0​. Λ+L0=diag(eikmzL0)m=−NkNk⊗I2\Lambda_+^{L_0}=\mathrm{diag}(e^{ik_{mz}L_0})_{m=-N_k}^{N_k}\otimes\mathbb I_2Λ+L0​​=diag(eikmz​L0​)m=−Nk​Nk​​⊗I2​, Λ−L0=(Λ+L0)∗\Lambda_-^{L_0}=(\Lambda_+^{L_0})^*Λ−L0​​=(Λ+L0​​)∗, Λ±L0=diag(Λ+L0,Λ−L0)\Lambda_\pm^{L_0}=\mathrm{diag}(\Lambda_+^{L_0},\Lambda_-^{L_0})Λ±L0​​=diag(Λ+L0​​,Λ−L0​​), Λ∓L0=(Λ±L0)∗\Lambda_\mp^{L_0}=(\Lambda_\pm^{L_0})^*Λ∓L0​​=(Λ±L0​​)∗. The transfer matrix of S=(rt′tr′)\mathbf S=\begin{pmatrix}\mathbf r&\mathbf t'\\\mathbf t&\mathbf r'\end{pmatrix}S=(rt​t′r′​) is M=(t−r′t′−1rr′t′−1−t′−1rt′−1)\mathbf M=\begin{pmatrix}\mathbf t-\mathbf r'\mathbf t'^{-1}\mathbf r&\mathbf r'\mathbf t'^{-1}\\-\mathbf t'^{-1}\mathbf r&\mathbf t'^{-1}\end{pmatrix}M=(t−r′t′−1r−t′−1r​r′t′−1t′−1​). Jn\mathbf J_nJn​ is the n×nn\times nn×n exchange matrix, σz=diag(1,−1)\boldsymbol\sigma_z=\mathrm{diag}(1,-1)σz​=diag(1,−1), and Sˉ\bar{\mathbf S}Sˉ is reciprocal if Sˉ=ΠSˉTΠ\bar{\mathbf S}=\Pi\bar{\mathbf S}^{\mathrm T}\PiSˉ=ΠSˉTΠ with Π=diag(J2Nk+1⊗σz,J2Nk+1⊗σz)\Pi=\mathrm{diag}(\mathbf J_{2N_k+1}\otimes\boldsymbol\sigma_z,\mathbf J_{2N_k+1}\otimes\boldsymbol\sigma_z)Π=diag(J2Nk​+1​⊗σz​,J2Nk​+1​⊗σz​). S\mathbf SS is the cascade of S1\mathbf S_1S1​ (left) and S2\mathbf S_2S2​ (right) if for all incoming amplitudes a\mathbf aa (left) and d\mathbf dd (right) there are amplitudes b,c\mathbf b,\mathbf cb,c between the slabs with b=t1a+r1′c\mathbf b=\mathbf t_1\mathbf a+\mathbf r_1'\mathbf cb=t1​a+r1′​c, c=r2b+t2′d\mathbf c=\mathbf r_2\mathbf b+\mathbf t_2'\mathbf dc=r2​b+t2′​d, and S(a,d)=(r1a+t1′c, t2b+r2′d)\mathbf S(\mathbf a,\mathbf d)=(\mathbf r_1\mathbf a+\mathbf t_1'\mathbf c,\ \mathbf t_2\mathbf b+\mathbf r_2'\mathbf d)S(a,d)=(r1​a+t1′​c, t2​b+r2′​d). 6. Scattering plane (Appendix D). For incident and outgoing unit directions eki,ekj\mathbf e_{ki},\mathbf e_{kj}eki​,ekj​: e⊥=eki×ekj/∣eki×ekj∣\mathbf e_\perp=\mathbf e_{ki}\times\mathbf e_{kj}/|\mathbf e_{ki}\times\mathbf e_{kj}|e⊥​=eki​×ekj​/∣eki​×ekj​∣, e∥i=e⊥×eki\mathbf e_{\parallel i}=\mathbf e_\perp\times\mathbf e_{ki}e∥i​=e⊥​×eki​, e∥j=e⊥×ekj\mathbf e_{\parallel j}=\mathbf e_\perp\times\mathbf e_{kj}e∥j​=e⊥​×ekj​; if eki×ekj=0\mathbf e_{ki}\times\mathbf e_{kj}=\mathbf 0eki​×ekj​=0, then e∥i=eθi\mathbf e_{\parallel i}=\mathbf e_{\theta i}e∥i​=eθi​, e∥j=eθj\mathbf e_{\parallel j}=\mathbf e_{\theta j}e∥j​=eθj​, e⊥=eϕi\mathbf e_\perp=\mathbf e_{\phi i}e⊥​=eϕi​. θ\thetaθ is the signed angle from eθ\mathbf e_\thetaeθ​ to e∥\mathbf e_\parallele∥​ about ek\mathbf e_kek​, R(θ)=(cos⁡θsin⁡θ−sin⁡θcos⁡θ)\mathbf R(\theta)=\begin{pmatrix}\cos\theta&\sin\theta\\-\sin\theta&\cos\theta\end{pmatrix}R(θ)=(cosθ−sinθ​sinθcosθ​), and (S2S3S4S1)\begin{pmatrix}S_2&S_3\\S_4&S_1\end{pmatrix}(S2​S4​​S3​S1​​) is the matrix of XXX between the frames (e∥i,e⊥′)(\mathbf e_{\parallel i},\mathbf e'_\perp)(e∥i​,e⊥′​) and (e∥j,e⊥′)(\mathbf e_{\parallel j},\mathbf e'_\perp)(e∥j​,e⊥′​) with e⊥′=−e⊥\mathbf e'_\perp=-\mathbf e_\perpe⊥′​=−e⊥​ (Bohren–Huffman convention).

Formalization Note Mode i∈{−Nk,…,Nk}i\in\{-N_k,\dots,N_k\}i∈{−Nk​,…,Nk​} is indexed by i+Nk∈{0,…,2Nk}i+N_k\in\{0,\dots,2N_k\}i+Nk​∈{0,…,2Nk​}, so mode −i-i−i is the reversed index and J2Nk+1\mathbf J_{2N_k+1}J2Nk​+1​ is the reversal. Polarization index 000 is θ\thetaθ, 111 is ϕ\phiϕ. The blocks tˉ′\bar{\mathbf t}'tˉ′, rˉ′\bar{\mathbf r}'rˉ′ are not printed in the paper ("analogous expressions"). They are written by analogy with Eqs. (14)–(15), using the phases implied by Table A1. The transfer-matrix convention is not written in the paper; Beenakker's convention, which the paper cites, is used. The reciprocity relation is taken from Byrnes and Foreman, Phys. Rev. Research 3, 013129 (2021), Eq. (98). The signed angle is the argument of ⟨eθ,e∥⟩+i⟨eθ×e∥,ek⟩\langle\mathbf e_\theta,\mathbf e_\parallel\rangle+i\langle\mathbf e_\theta\times\mathbf e_\parallel,\mathbf e_k\rangle⟨eθ​,e∥​⟩+i⟨eθ​×e∥​,ek​⟩, which also covers θ=π\theta=\piθ=π, a value the paper's range −π<θ<π-\pi<\theta<\pi−π<θ<π leaves out.

Definition code
import Mathlib

/-!
N. Byrnes and M. R. Foreman, *Random matrix theory of polarized light scattering in disordered
media*, arXiv:2205.09423v1 (2022).

Definitions for Section 2 (Eqs. (9)–(17), (19), (22)–(28)) and Appendices A–D: the discrete mode
set, the polar basis of Eq. (11), the transmission and reflection matrices of a slab of particles in
the single-scattering approximation and their normalized `2 × 2` blocks, the block scattering matrix,
the ensemble assumptions of Section 2.2, covariances and pseudo-covariances, the propagation phase
matrices of Appendix C, the transfer matrix, reciprocity, the cascade of two slabs (Appendix B) and
the scattering-plane frames of Appendix D.

Mode `i : Fin (2 * Nk + 1)` stands for the paper's index `i - Nk ∈ {-Nk, …, Nk}`, so the paper's
mode `-i` is `Fin.rev i`. Polarization index `0` is `θ` and `1` is `φ`.
-/

open MeasureTheory ProbabilityTheory Matrix

noncomputable section

namespace Arxiv2205_09423

/-- Section 2.1, p. 5: the discrete mode set `K = {-κ_{N_k}, …, -κ_1, 0, κ_1, …, κ_{N_k}}` of
transverse wavevectors `κ_i = (kx i, ky i)`, the wavenumber `k = 2π/λ` and the common cubature
weight `w`. -/
structure ModeSet (Nk : ℕ) where
  /-- wavenumber `k = 2π/λ` -/
  k : ℝ
  /-- `x` components of the transverse wavevectors -/
  kx : Fin (2 * Nk + 1) → ℝ
  /-- `y` components of the transverse wavevectors -/
  ky : Fin (2 * Nk + 1) → ℝ
  /-- cubature weight of every mode -/
  w : ℝ

namespace ModeSet

variable {Nk : ℕ} (K : ModeSet Nk)

/-- Section 2.1, pp. 4–5: `k > 0`; every mode is a homogeneous plane wave, `|κ_i| < k`; modes come
in inverse pairs, `κ_{-i} = -κ_i` (so `κ_0 = 0`); the `2 N_k + 1` modes are distinct; and the equal
weights are `w = π k² / (2 N_k + 1)`. -/
def IsValid : Prop :=
  0 < K.k ∧ (∀ i, K.kx i ^ 2 + K.ky i ^ 2 < K.k ^ 2) ∧
    (∀ i, K.kx (Fin.rev i) = -K.kx i ∧ K.ky (Fin.rev i) = -K.ky i) ∧
    Function.Injective (fun i => (K.kx i, K.ky i)) ∧
    K.w = Real.pi * K.k ^ 2 / (2 * Nk + 1)

/-- Section 2.1, p. 4: `k_{iz} = (k² - k_{ix}² - k_{iy}²)^{1/2}`. -/
def kz (i : Fin (2 * Nk + 1)) : ℝ := Real.sqrt (K.k ^ 2 - K.kx i ^ 2 - K.ky i ^ 2)

/-- Section 2.1, p. 4: the right-propagating wavevector `k_i = (k_{ix}, k_{iy}, k_{iz})`. -/
def kvec (i : Fin (2 * Nk + 1)) : Fin 3 → ℝ := ![K.kx i, K.ky i, K.kz i]

/-- Section 2.1, p. 5: the left-propagating wavevector `k̃_i = (k_{ix}, k_{iy}, -k_{iz})`. -/
def kvecT (i : Fin (2 * Nk + 1)) : Fin 3 → ℝ := ![K.kx i, K.ky i, -K.kz i]

/-- Eq. (14), p. 6: `C_{ji} = w / (2π k √(k_{jz} k_{iz}))`. -/
def cji (j i : Fin (2 * Nk + 1)) : ℝ :=
  K.w / (2 * Real.pi * K.k * Real.sqrt (K.kz j * K.kz i))

/-- Eq. (25), p. 8: `C_{ijuv} = w n ΔL / (k² √(k_{iz} k_{jz} k_{uz} k_{vz}))`, for particle
density `n` and slab thickness `ΔL = dL`. -/
def cijuv (n dL : ℝ) (i j u v : Fin (2 * Nk + 1)) : ℝ :=
  K.w * n * dL / (K.k ^ 2 * Real.sqrt (K.kz i * K.kz j * K.kz u * K.kz v))

/-- Eqs. (24)–(25), p. 8: `δ^R = 1` when `k_{ix} - k_{jx} = k_{ux} - k_{vx}` and
`k_{iy} - k_{jy} = k_{uy} - k_{vy}` (the memory-effect condition), and `0` otherwise. -/
def deltaR (i j u v : Fin (2 * Nk + 1)) : ℝ :=
  if K.kx i - K.kx j = K.kx u - K.kx v ∧ K.ky i - K.ky j = K.ky u - K.ky v then 1 else 0

/-- Eqs. (27)–(28), p. 9: `δ^P = 1` when `k_{ix} - k_{jx} = -(k_{ux} - k_{vx})` and
`k_{iy} - k_{jy} = -(k_{uy} - k_{vy})`, and `0` otherwise. -/
def deltaP (i j u v : Fin (2 * Nk + 1)) : ℝ :=
  if K.kx i - K.kx j = -(K.kx u - K.kx v) ∧ K.ky i - K.ky j = -(K.ky u - K.ky v) then 1 else 0

end ModeSet

/-- Euclidean norm `|v|` of a vector of `ℝ³`. -/
def vnorm (v : Fin 3 → ℝ) : ℝ := Real.sqrt (dotProduct v v)

/-- The unit vector `v / |v|`. -/
def normalize (v : Fin 3 → ℝ) : Fin 3 → ℝ := (vnorm v)⁻¹ • v

/-- The unit vector `ẑ`. -/
def zhat : Fin 3 → ℝ := ![0, 0, 1]

/-- Eq. (11), p. 5: `e_φ = (ẑ × e_k)/|ẑ × e_k|` for the unit propagation direction `e_k`, with
`e_φ = ±ŷ` in the special cases `e_k = ±ẑ`. -/
def ePhi (e : Fin 3 → ℝ) : Fin 3 → ℝ :=
  if e 0 = 0 ∧ e 1 = 0 then (if 0 < e 2 then ![0, 1, 0] else ![0, -1, 0])
  else normalize (crossProduct zhat e)

/-- Eq. (11), p. 5: `e_θ = (e_φ × e_k)/|e_φ × e_k|`. -/
def eTheta (e : Fin 3 → ℝ) : Fin 3 → ℝ := normalize (crossProduct (ePhi e) e)

/-- Eq. (11): the polarization basis `(e_θ, e_φ)` attached to the unit direction `e`. -/
def polarBasis (e : Fin 3 → ℝ) : Fin 2 → Fin 3 → ℝ := ![eTheta e, ePhi e]

/-- Eq. (2), p. 4: the far-field amplitude of one particle, `A(u_out, u_in)`, a `3 × 3` complex
matrix (entries `a b`) for each observation direction `u_out` and incidence direction `u_in`. -/
abbrev Amp := (Fin 3 → ℝ) → (Fin 3 → ℝ) → Fin 3 → Fin 3 → ℂ

/-- Eqs. (12)–(13), p. 5: the reduced `2 × 2` matrix `[e_m(u_out)ᵀ X e_n(u_in)]_{m n}` of a
`3 × 3` matrix `X`, in the polar bases of the incident direction `u_in` and outgoing direction
`u_out`. -/
def reduce (X : Fin 3 → Fin 3 → ℂ) (uin uout : Fin 3 → ℝ) : Matrix (Fin 2) (Fin 2) ℂ :=
  Matrix.of fun m n => ∑ a, ∑ b, (polarBasis uout m a : ℂ) * X a b * (polarBasis uin n b : ℂ)

section Slab

variable {Nk : ℕ} (K : ModeSet Nk) {N : ℕ}

/-- Eq. (9), p. 5: the discretized `3 × 3` transmission matrix of a slab containing `N` particles
with centres `r p` and amplitudes `A p`:
`t(κ_j, κ_i) = (δ_{ij}/w) I₃ + (2π k k_{jz})⁻¹ ∑_p A_p(u_j, u_i) e^{i(k_i - k_j)·r_p}`. -/
def tMat3 (A : Fin N → Amp) (r : Fin N → Fin 3 → ℝ) (j i : Fin (2 * Nk + 1)) :
    Fin 3 → Fin 3 → ℂ :=
  fun a b => (if i = j then ((K.w : ℂ)⁻¹ * (if a = b then 1 else 0)) else 0) +
    ((2 * Real.pi * K.k * K.kz j : ℝ) : ℂ)⁻¹ *
      ∑ p, A p (K.k⁻¹ • K.kvec j) (K.k⁻¹ • K.kvec i) a b *
        Complex.exp (Complex.I * ((dotProduct (K.kvec i - K.kvec j) (r p) : ℝ) : ℂ))

/-- Eq. (10), p. 5: the discretized `3 × 3` reflection matrix
`r(κ_j, κ_i) = (2π k k_{jz})⁻¹ ∑_p A_p(ũ_j, u_i) e^{i(k_i - k̃_j)·r_p}`. -/
def rMat3 (A : Fin N → Amp) (r : Fin N → Fin 3 → ℝ) (j i : Fin (2 * Nk + 1)) :
    Fin 3 → Fin 3 → ℂ :=
  fun a b => ((2 * Real.pi * K.k * K.kz j : ℝ) : ℂ)⁻¹ *
      ∑ p, A p (K.k⁻¹ • K.kvecT j) (K.k⁻¹ • K.kvec i) a b *
        Complex.exp (Complex.I * ((dotProduct (K.kvec i - K.kvecT j) (r p) : ℝ) : ℂ))

/-- Eq. (14), first equality, p. 6: `t̄_{(j,i)} = √(k_{jz}/k_{iz}) t_{(j,i)} w`, where `t_{(j,i)}` is
the reduction (12) of the matrix (9). -/
def tNorm (A : Fin N → Amp) (r : Fin N → Fin 3 → ℝ) (j i : Fin (2 * Nk + 1)) :
    Matrix (Fin 2) (Fin 2) ℂ :=
  ((Real.sqrt (K.kz j / K.kz i) * K.w : ℝ) : ℂ) •
    reduce (tMat3 K A r j i) (K.k⁻¹ • K.kvec i) (K.k⁻¹ • K.kvec j)

/-- Eq. (15), first equality, p. 6: `r̄_{(j,i)} = √(k_{jz}/k_{iz}) r_{(j,i)} w`, where `r_{(j,i)}` is
the reduction (13) of the matrix (10). -/
def rNorm (A : Fin N → Amp) (r : Fin N → Fin 3 → ℝ) (j i : Fin (2 * Nk + 1)) :
    Matrix (Fin 2) (Fin 2) ℂ :=
  ((Real.sqrt (K.kz j / K.kz i) * K.w : ℝ) : ℂ) •
    reduce (rMat3 K A r j i) (K.k⁻¹ • K.kvec i) (K.k⁻¹ • K.kvecT j)

/-- Eqs. (14)–(15), p. 6: the reduced single-particle matrix `A_{(j,i)}` ("defined analogously to
`t_{(j,i)}`") for incident wavevector `vin i` and outgoing wavevector `vout j`:
`A^t_{(j,i)}` is `ampRed K X K.kvec K.kvec j i`, `A^r_{(j,i)}` is `ampRed K X K.kvec K.kvecT j i`. -/
def ampRed (X : Amp) (vin vout : Fin (2 * Nk + 1) → Fin 3 → ℝ) (j i : Fin (2 * Nk + 1)) :
    Matrix (Fin 2) (Fin 2) ℂ :=
  reduce (X (K.k⁻¹ • vout j) (K.k⁻¹ • vin i)) (K.k⁻¹ • vin i) (K.k⁻¹ • vout j)

/-- Eqs. (14)–(15), p. 6: the scattered part `C_{ji} ∑_p A_{p(j,i)} e^{i(vin_i - vout_j)·r_p}`
of a normalized block, for incident wavevectors `vin` and outgoing wavevectors `vout`. -/
def blockSum (A : Fin N → Amp) (r : Fin N → Fin 3 → ℝ) (vin vout : Fin (2 * Nk + 1) → Fin 3 → ℝ)
    (j i : Fin (2 * Nk + 1)) : Matrix (Fin 2) (Fin 2) ℂ :=
  ((K.cji j i : ℝ) : ℂ) • ∑ p,
    Complex.exp (Complex.I * ((dotProduct (vin i - vout j) (r p) : ℝ) : ℂ)) •
      ampRed K (A p) vin vout j i

/-- Eq. (14), second equality, p. 6: the normalized transmission block
`t̄_{(j,i)} = δ_{ij} I₂ + C_{ji} ∑_p A^t_{p(j,i)} e^{i(k_i - k_j)·r_p}`. -/
def tbar (A : Fin N → Amp) (r : Fin N → Fin 3 → ℝ) (j i : Fin (2 * Nk + 1)) :
    Matrix (Fin 2) (Fin 2) ℂ :=
  (if i = j then 1 else 0) + blockSum K A r K.kvec K.kvec j i

/-- Eq. (15), second equality, p. 6: the normalized reflection block
`r̄_{(j,i)} = C_{ji} ∑_p A^r_{p(j,i)} e^{i(k_i - k̃_j)·r_p}`. -/
def rbar (A : Fin N → Amp) (r : Fin N → Fin 3 → ℝ) (j i : Fin (2 * Nk + 1)) :
    Matrix (Fin 2) (Fin 2) ℂ :=
  blockSum K A r K.kvec K.kvecT j i

/-- Section 2.1, p. 6 ("analogous expressions … for a left-propagating plane wave incident upon the
right side"; not printed in the paper): the normalized transmission block for incidence from the
right, `t̄'_{(j,i)} = δ_{ij} I₂ + C_{ji} ∑_p A^{t'}_{p(j,i)} e^{i(k̃_i - k̃_j)·r_p}`, with incident
direction `ũ_i` and outgoing direction `ũ_j`; these are the phases of Table A1, p. 24. -/
def tpbar (A : Fin N → Amp) (r : Fin N → Fin 3 → ℝ) (j i : Fin (2 * Nk + 1)) :
    Matrix (Fin 2) (Fin 2) ℂ :=
  (if i = j then 1 else 0) + blockSum K A r K.kvecT K.kvecT j i

/-- Section 2.1, p. 6 (not printed in the paper, see `tpbar`): the normalized reflection block for
incidence from the right, `r̄'_{(j,i)} = C_{ji} ∑_p A^{r'}_{p(j,i)} e^{i(k̃_i - k_j)·r_p}`, with
incident direction `ũ_i` and outgoing direction `u_j`. -/
def rpbar (A : Fin N → Amp) (r : Fin N → Fin 3 → ℝ) (j i : Fin (2 * Nk + 1)) :
    Matrix (Fin 2) (Fin 2) ℂ :=
  blockSum K A r K.kvecT K.kvec j i

end Slab

/-- Index set of the rows of `t̄` in Eq. (16): a mode and a polarization (`θ = 0`, `φ = 1`). -/
abbrev MIdx (Nk : ℕ) := Fin (2 * Nk + 1) × Fin 2

/-- Eq. (16), p. 6: the full matrix built from the `2 × 2` blocks `B_{(j,i)}`, block row `j`,
block column `i`. -/
def assemble {Nk : ℕ} (B : Fin (2 * Nk + 1) → Fin (2 * Nk + 1) → Matrix (Fin 2) (Fin 2) ℂ) :
    Matrix (MIdx Nk) (MIdx Nk) ℂ :=
  Matrix.of fun x y => B x.1 y.1 x.2 y.2

/-- Eq. (17), p. 6: the normalized scattering matrix `S̄ = [[r̄, t̄'], [t̄, r̄']]` of a slab. -/
def sMat {Nk N : ℕ} (K : ModeSet Nk) (A : Fin N → Amp) (r : Fin N → Fin 3 → ℝ) :
    Matrix (MIdx Nk ⊕ MIdx Nk) (MIdx Nk ⊕ MIdx Nk) ℂ :=
  Matrix.fromBlocks (assemble (rbar K A r)) (assemble (tpbar K A r)) (assemble (tbar K A r))
    (assemble (rpbar K A r))

/-- Section 2.2, pp. 6–7: the ensemble of slabs of thickness `ΔL = dL` and particle density `n`.
On the probability space `(Ω, P)`, particle `p` has centre `r p` and amplitude `A p`, and:
the particles are statistically independent; each particle's morphology is independent of its
position; the amplitudes are identically distributed (with finite second moments); the `z`
coordinate of each centre is uniform on `[-ΔL/2, ΔL/2]` and independent of the transverse
position (uniform distribution in the slab); and the transverse phase averages obey the paper's
discretization of Eq. (19), `N ⟨e^{i q·ρ}⟩ = (2π)² n ΔL δ_{q,0} / w`, for every transverse vector
`q = κ_i - κ_j - κ_u + κ_v` built from the modes (the replacement
`δ(q_x) δ(q_y) → δ_{q,0}/w` of p. 7, made after the limit `N, V → ∞` at fixed `n = N/V`). -/
def IsSlabEnsemble {Nk : ℕ} (K : ModeSet Nk) (dL n : ℝ) {Ω : Type*} [MeasurableSpace Ω]
    (P : Measure Ω) {N : ℕ} (r : Fin N → Ω → Fin 3 → ℝ) (A : Fin N → Ω → Amp) : Prop :=
  IsProbabilityMeasure P ∧ 0 < dL ∧ 0 < n ∧
    (∀ p, Measurable (r p)) ∧ (∀ p, Measurable (A p)) ∧
    iIndepFun (fun p ω => (r p ω, A p ω)) P ∧
    (∀ p, IndepFun (r p) (A p) P) ∧
    (∀ p q, IdentDistrib (A p) (A q) P P) ∧
    (∀ p uo ui a b, MemLp (fun ω => A p ω uo ui a b) 2 P) ∧
    (∀ p, IndepFun (fun ω => (r p ω 0, r p ω 1)) (fun ω => r p ω 2) P) ∧
    (∀ p, pdf.IsUniform (fun ω => r p ω 2) (Set.Icc (-dL / 2) (dL / 2)) P) ∧
    (∀ p i j u v,
      (N : ℂ) * ∫ ω, Complex.exp (Complex.I *
          ((((K.kx i - K.kx j - K.kx u + K.kx v) * r p ω 0 +
            (K.ky i - K.ky j - K.ky u + K.ky v) * r p ω 1 : ℝ)) : ℂ)) ∂P =
        if K.kx i - K.kx j - K.kx u + K.kx v = 0 ∧ K.ky i - K.ky j - K.ky u + K.ky v = 0 then
          (((2 * Real.pi) ^ 2 * n * dL / K.w : ℝ) : ℂ)
        else 0)

/-- Eq. (25), left side, p. 8: the covariance `⟨X Y*⟩ - ⟨X⟩⟨Y*⟩` of two complex random
variables. -/
def covC {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) (X Y : Ω → ℂ) : ℂ :=
  (∫ ω, X ω * star (Y ω) ∂P) - (∫ ω, X ω ∂P) * star (∫ ω, Y ω ∂P)

/-- Eq. (27), left side, p. 9: the pseudo-covariance `⟨X Y⟩ - ⟨X⟩⟨Y⟩` (no complex conjugate). -/
def pcovC {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) (X Y : Ω → ℂ) : ℂ :=
  (∫ ω, X ω * Y ω ∂P) - (∫ ω, X ω ∂P) * (∫ ω, Y ω ∂P)

/-- Appendix C, p. 25: the slab moved rigidly so that every particle centre is translated by
`L₀` along `z`. -/
def shiftZ {N : ℕ} (L0 : ℝ) (r : Fin N → Fin 3 → ℝ) : Fin N → Fin 3 → ℝ :=
  fun p => r p + ![0, 0, L0]

/-- Eq. (C1), p. 25: `Λ₊^{L₀} = diag(e^{i k_{-N_k z} L₀}, …, e^{i k_{N_k z} L₀}) ⊗ I₂`. -/
def lamPlus {Nk : ℕ} (K : ModeSet Nk) (L0 : ℝ) : Matrix (MIdx Nk) (MIdx Nk) ℂ :=
  Matrix.kroneckerMap (· * ·)
    (Matrix.diagonal fun i => Complex.exp (Complex.I * ((K.kz i * L0 : ℝ) : ℂ)))
    (1 : Matrix (Fin 2) (Fin 2) ℂ)

/-- Appendix C, p. 25: `Λ₋^{L₀} = (Λ₊^{L₀})*` (entrywise complex conjugate). -/
def lamMinus {Nk : ℕ} (K : ModeSet Nk) (L0 : ℝ) : Matrix (MIdx Nk) (MIdx Nk) ℂ :=
  (lamPlus K L0).map star

/-- Appendix C, p. 25: `Λ_±^{L₀} = diag(Λ₊^{L₀}, Λ₋^{L₀})`. -/
def lamPM {Nk : ℕ} (K : ModeSet Nk) (L0 : ℝ) :
    Matrix (MIdx Nk ⊕ MIdx Nk) (MIdx Nk ⊕ MIdx Nk) ℂ :=
  Matrix.fromBlocks (lamPlus K L0) 0 0 (lamMinus K L0)

/-- Appendix C, p. 25: `Λ_∓^{L₀} = (Λ_±^{L₀})*` (entrywise complex conjugate). -/
def lamMP {Nk : ℕ} (K : ModeSet Nk) (L0 : ℝ) :
    Matrix (MIdx Nk ⊕ MIdx Nk) (MIdx Nk ⊕ MIdx Nk) ℂ :=
  (lamPM K L0).map star

/-- Section 2.3, p. 10 (the paper cites Beenakker, Rev. Mod. Phys. 69, 731 (1997), and does not
write the convention out): the transfer matrix of `S = [[r, t'], [t, r']]`, which maps the
right- and left-propagating amplitudes on the left of the slab to those on its right,
`M = [[t - r' t'⁻¹ r, r' t'⁻¹], [-t'⁻¹ r, t'⁻¹]]` (meaningful when `t'` is invertible). -/
def transfer {V : Type*} [Fintype V] [DecidableEq V] (S : Matrix (V ⊕ V) (V ⊕ V) ℂ) :
    Matrix (V ⊕ V) (V ⊕ V) ℂ :=
  Matrix.fromBlocks (S.toBlocks₂₁ - S.toBlocks₂₂ * S.toBlocks₁₂⁻¹ * S.toBlocks₁₁)
    (S.toBlocks₂₂ * S.toBlocks₁₂⁻¹) (-(S.toBlocks₁₂⁻¹ * S.toBlocks₁₁)) S.toBlocks₁₂⁻¹

/-- Appendix B, p. 25: the `n × n` exchange matrix `J_n`, with ones on the anti-diagonal. -/
def exch (n : ℕ) : Matrix (Fin n) (Fin n) ℂ := Matrix.of fun a b => if a = Fin.rev b then 1 else 0

/-- Appendix B, p. 25: `σ_z = diag(1, -1)`. -/
def sigmaZ : Matrix (Fin 2) (Fin 2) ℂ := Matrix.diagonal ![1, -1]

/-- Appendix B, p. 25: `J_{2N_k+1} ⊗ σ_z`. -/
def piMat (Nk : ℕ) : Matrix (MIdx Nk) (MIdx Nk) ℂ :=
  Matrix.kroneckerMap (· * ·) (exch (2 * Nk + 1)) sigmaZ

/-- Reciprocity of a normalized scattering matrix, used in Appendix B (p. 25) and Section 2.3
(p. 10), as derived in Byrnes and Foreman, Phys. Rev. Research 3, 013129 (2021), Eq. (98):
`S̄ = Π S̄ᵀ Π` with `Π = diag(J ⊗ σ_z, J ⊗ σ_z)`; blockwise `r̄ = (J⊗σ_z) r̄ᵀ (J⊗σ_z)`,
`t̄' = (J⊗σ_z) t̄ᵀ (J⊗σ_z)`, `r̄' = (J⊗σ_z) r̄'ᵀ (J⊗σ_z)`. -/
def IsReciprocal {Nk : ℕ} (S : Matrix (MIdx Nk ⊕ MIdx Nk) (MIdx Nk ⊕ MIdx Nk) ℂ) : Prop :=
  S = Matrix.fromBlocks (piMat Nk) 0 0 (piMat Nk) * S.transpose *
    Matrix.fromBlocks (piMat Nk) 0 0 (piMat Nk)

/-- Appendix B, p. 24: `S` is the scattering matrix of the system made of slab 1 (scattering matrix
`S₁ = [[r₁, t₁'], [t₁, r₁']]`) to the left of slab 2 (`S₂`): for all incoming amplitudes `a` (from
the left) and `d` (from the right) there are amplitudes `b` (right-propagating) and `c`
(left-propagating) between the slabs such that `b = t₁ a + r₁' c`, `c = r₂ b + t₂' d`, and `S`
maps `(a, d)` to the outgoing amplitudes `(r₁ a + t₁' c, t₂ b + r₂' d)`. -/
def IsCascade {V : Type*} [Fintype V] (S1 S2 S : Matrix (V ⊕ V) (V ⊕ V) ℂ) : Prop :=
  ∀ a d : V → ℂ, ∃ b c : V → ℂ,
    b = S1.toBlocks₂₁ *ᵥ a + S1.toBlocks₂₂ *ᵥ c ∧
    c = S2.toBlocks₁₁ *ᵥ b + S2.toBlocks₁₂ *ᵥ d ∧
    S *ᵥ Sum.elim a d =
      Sum.elim (S1.toBlocks₁₁ *ᵥ a + S1.toBlocks₁₂ *ᵥ c) (S2.toBlocks₂₁ *ᵥ b + S2.toBlocks₂₂ *ᵥ d)

/-- Appendix D, p. 26: the unit normal `e_⊥ = (e_{ki} × e_{kj})/|e_{ki} × e_{kj}|` of the
scattering plane of incident direction `ui` and outgoing direction `uj`; when the two directions
are parallel (cross product zero), `e_⊥ = e_{φ i}`. -/
def ePerp (ui uj : Fin 3 → ℝ) : Fin 3 → ℝ :=
  if crossProduct ui uj = 0 then ePhi ui else normalize (crossProduct ui uj)

/-- Appendix D, p. 26: `e_{∥ i} = e_⊥ × e_{ki}`, and `e_{∥ i} = e_{θ i}` when the directions are
parallel. -/
def eParIn (ui uj : Fin 3 → ℝ) : Fin 3 → ℝ :=
  if crossProduct ui uj = 0 then eTheta ui else crossProduct (ePerp ui uj) ui

/-- Appendix D, p. 26: `e_{∥ j} = e_⊥ × e_{kj}`, and `e_{∥ j} = e_{θ j}` when the directions are
parallel. -/
def eParOut (ui uj : Fin 3 → ℝ) : Fin 3 → ℝ :=
  if crossProduct ui uj = 0 then eTheta uj else crossProduct (ePerp ui uj) uj

/-- Appendix D, p. 26: the signed angle `θ` from `e_θ` to `e_∥` about the propagation direction
`e_k`: `|θ|` is the angle between them and `θ > 0` when `e_θ × e_∥` points along `e_k`
(the argument of `⟨e_θ, e_∥⟩ + i ⟨e_θ × e_∥, e_k⟩`, in `(-π, π]`). -/
def signedAngle (eth epar ek : Fin 3 → ℝ) : ℝ :=
  Complex.arg ⟨dotProduct eth epar, dotProduct (crossProduct eth epar) ek⟩

/-- Eq. (D1), p. 26: `R(θ) = [[cos θ, sin θ], [-sin θ, cos θ]]`. -/
def rotM (t : ℝ) : Matrix (Fin 2) (Fin 2) ℂ :=
  !![(Real.cos t : ℂ), (Real.sin t : ℂ); (-(Real.sin t) : ℂ), (Real.cos t : ℂ)]

/-- Appendix D, p. 26: the amplitude matrix `[[S₂, S₃], [S₄, S₁]]` of a `3 × 3` matrix `X` with
respect to the scattering plane, in the convention of Bohren and Huffman: components along
`(e_∥, e'_⊥)` with `e'_⊥ = -e_⊥`, for incidence direction `ui` and outgoing direction `uj`. -/
def ampScatPlane (X : Fin 3 → Fin 3 → ℂ) (ui uj : Fin 3 → ℝ) : Matrix (Fin 2) (Fin 2) ℂ :=
  Matrix.of fun m n => ∑ a, ∑ b,
    ((![eParOut ui uj, -ePerp ui uj] m a : ℝ) : ℂ) * X a b *
      ((![eParIn ui uj, -ePerp ui uj] n b : ℝ) : ℂ)

end Arxiv2205_09423
Source
Byrnes and Foreman, Random matrix theory of polarized light scattering in disordered media, arXiv:2205.09423v1 (2022), Section 2.1 (Eqs. (9)-(17)), Section 2.2 (Eqs. (18)-(27)), Section 2.3 (Eq. (28)), Appendices A-D (Table A1, Eqs. (B1)-(B2), (C1)-(C3), (D1)-(D2))
Read-back

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

Conventions used throughout. NkN_kNk​ is a natural number and the mode index iii ranges over the finite set I={0,1,…,2Nk}\mathcal I=\{0,1,\dots,2N_k\}I={0,1,…,2Nk​}, which has 2Nk+12N_k+12Nk​+1 elements. For i∈Ii\in\mathcal Ii∈I write iˉ:=2Nk−i\bar i := 2N_k-iiˉ:=2Nk​−i for the reversed index. Polarization indices range over {0,1}\{0,1\}{0,1}. Every division x/yx/yx/y and every inverse y−1y^{-1}y−1 of a real or complex number returns 000 when y=0y=0y=0. Every square root x\sqrt{x}x​ of a real number returns 000 when x<0x<0x<0.


Mode set (ModeSet\mathsf{ModeSet}ModeSet). A mode set KKK for a given NkN_kNk​ consists of four pieces of data, with no constraints imposed:

  • a real number kkk;
  • two real-valued families (kix)i∈I(k_{ix})_{i\in\mathcal I}(kix​)i∈I​ and (kiy)i∈I(k_{iy})_{i\in\mathcal I}(kiy​)i∈I​;
  • a real number www.

Validity (IsValid\mathsf{IsValid}IsValid). A mode set KKK is valid when all of the following hold:

  1. k>0k>0k>0.
  2. kix2+kiy2<k2k_{ix}^2+k_{iy}^2<k^2kix2​+kiy2​<k2 for every i∈Ii\in\mathcal Ii∈I.
  3. kiˉx=−kixk_{\bar i x}=-k_{ix}kiˉx​=−kix​ and kiˉy=−kiyk_{\bar i y}=-k_{iy}kiˉy​=−kiy​ for every iii. Because Nk‾=Nk\overline{N_k}=N_kNk​​=Nk​, this forces kNkx=kNky=0k_{N_k x}=k_{N_k y}=0kNk​x​=kNk​y​=0.
  4. The map i↦(kix,kiy)i\mapsto(k_{ix},k_{iy})i↦(kix​,kiy​) is injective, so the 2Nk+12N_k+12Nk​+1 transverse vectors are pairwise distinct.
  5. w=πk2/(2Nk+1)w=\pi k^2/(2N_k+1)w=πk2/(2Nk​+1).

Longitudinal wavenumber (kizk_{iz}kiz​). It is defined as

kiz=k2−kix2−kiy2.k_{iz}=\sqrt{k^2-k_{ix}^2-k_{iy}^2}.kiz​=k2−kix2​−kiy2​​.

This value is always ≥0\ge 0≥0. It is 000, not imaginary, whenever the radicand is negative. Under validity it is strictly positive.

Wavevectors. The two wavevectors attached to mode iii are

ki=(kix,kiy,kiz),k~i=(kix,kiy,−kiz).\mathbf k_i=(k_{ix},k_{iy},k_{iz}),\qquad \tilde{\mathbf k}_i=(k_{ix},k_{iy},-k_{iz}).ki​=(kix​,kiy​,kiz​),k~i​=(kix​,kiy​,−kiz​).

Coefficient CjiC_{ji}Cji​. It is defined as

Cji=w2πkkjzkiz.C_{ji}=\frac{w}{2\pi k\sqrt{k_{jz}k_{iz}}}.Cji​=2πkkjz​kiz​​w​.

It equals 000 if the denominator vanishes, for example when k=0k=0k=0 or some kiz=0k_{iz}=0kiz​=0.

Coefficient CijuvC_{ijuv}Cijuv​. For real parameters nnn and ΔL\Delta LΔL, and indices i,j,u,v∈Ii,j,u,v\in\mathcal Ii,j,u,v∈I,

Cijuv(n,ΔL)=w n ΔLk2kizkjzkuzkvz.C_{ijuv}(n,\Delta L)=\frac{w\,n\,\Delta L}{k^2\sqrt{k_{iz}k_{jz}k_{uz}k_{vz}}}.Cijuv​(n,ΔL)=k2kiz​kjz​kuz​kvz​​wnΔL​.

It equals 000 if the denominator vanishes.

Indicator δijuvR\delta^R_{ijuv}δijuvR​. It equals 111 if both

kix−kjx=kux−kvxandkiy−kjy=kuy−kvyk_{ix}-k_{jx}=k_{ux}-k_{vx}\quad\text{and}\quad k_{iy}-k_{jy}=k_{uy}-k_{vy}kix​−kjx​=kux​−kvx​andkiy​−kjy​=kuy​−kvy​

hold as exact real equalities, and 000 otherwise.

Indicator δijuvP\delta^P_{ijuv}δijuvP​. It equals 111 if both

kix−kjx=−(kux−kvx)andkiy−kjy=−(kuy−kvy)k_{ix}-k_{jx}=-(k_{ux}-k_{vx})\quad\text{and}\quad k_{iy}-k_{jy}=-(k_{uy}-k_{vy})kix​−kjx​=−(kux​−kvx​)andkiy​−kjy​=−(kuy​−kvy​)

hold exactly, and 000 otherwise.


Norm and normalization. For v∈R3v\in\mathbb R^3v∈R3, ∣v∣=v⋅v|v|=\sqrt{v\cdot v}∣v∣=v⋅v​ and v^=∣v∣−1v\hat v=|v|^{-1}vv^=∣v∣−1v. The zero vector normalizes to the zero vector. Also z^=(0,0,1)\hat{\mathbf z}=(0,0,1)z^=(0,0,1).

eφ(e)\mathbf e_\varphi(e)eφ​(e). This is defined for an arbitrary e=(e1,e2,e3)∈R3e=(e_1,e_2,e_3)\in\mathbb R^3e=(e1​,e2​,e3​)∈R3; eee is not assumed to be a unit vector.

  • If e1=e2=0e_1=e_2=0e1​=e2​=0: eφ(e)=(0,1,0)\mathbf e_\varphi(e)=(0,1,0)eφ​(e)=(0,1,0) when e3>0e_3>0e3​>0, and (0,−1,0)(0,-1,0)(0,−1,0) otherwise. In particular, e=0e=0e=0 gives (0,−1,0)(0,-1,0)(0,−1,0).
  • Otherwise: eφ(e)\mathbf e_\varphi(e)eφ​(e) is the normalization of z^×e\hat{\mathbf z}\times ez^×e.

eθ(e)\mathbf e_\theta(e)eθ​(e). It is the normalization of eφ(e)×e\mathbf e_\varphi(e)\times eeφ​(e)×e. The polar basis of eee is the ordered pair (e0,e1)=(eθ(e),eφ(e))(\mathbf e_0,\mathbf e_1)=(\mathbf e_\theta(e),\mathbf e_\varphi(e))(e0​,e1​)=(eθ​(e),eφ​(e)).

Amplitude function. An amplitude function XXX assigns a complex 3×33\times33×3 matrix X(u,u′)X(u,u')X(u,u′) to every ordered pair of vectors u,u′∈R3u,u'\in\mathbb R^3u,u′∈R3. No regularity or symmetry is required.

Reduction. For a complex 3×33\times 33×3 matrix XXX and vectors uin,uout∈R3u_{\rm in},u_{\rm out}\in\mathbb R^3uin​,uout​∈R3, the reduction is the 2×22\times22×2 complex matrix

[red⁡(X;uin,uout)]mn=em(uout)T X en(uin),m,n∈{0,1}.\big[\operatorname{red}(X;u_{\rm in},u_{\rm out})\big]_{mn}=\mathbf e_m(u_{\rm out})^{\mathsf T}\,X\,\mathbf e_n(u_{\rm in}),\qquad m,n\in\{0,1\}.[red(X;uin​,uout​)]mn​=em​(uout​)TXen​(uin​),m,n∈{0,1}.

Here em(u)\mathbf e_m(u)em​(u) is the polar basis of uuu just defined. The vectors uin,uoutu_{\rm in},u_{\rm out}uin​,uout​ are not required to be unit vectors.


Slab data. Throughout this part, fix a mode set KKK (not assumed valid) and a number NNN of particles. Particle p∈{0,…,N−1}p\in\{0,\dots,N-1\}p∈{0,…,N−1} has an amplitude function ApA_pAp​ and a centre rp∈R3\mathbf r_p\in\mathbb R^3rp​∈R3. All sums over ppp run over these NNN particles and are empty if N=0N=0N=0.

3×33\times33×3 transmission matrix tji(3)t^{(3)}_{ji}tji(3)​. Its (a,b)(a,b)(a,b) entry is

[tji(3)]ab=[i=j] w−1δab+12πk kjz∑p[Ap(k−1kj, k−1ki)]ab e i(ki−kj)⋅rp.\big[t^{(3)}_{ji}\big]_{ab}=[i=j]\,w^{-1}\delta_{ab}+\frac{1}{2\pi k\,k_{jz}}\sum_p \big[A_p(k^{-1}\mathbf k_j,\,k^{-1}\mathbf k_i)\big]_{ab}\,e^{\,\mathrm i(\mathbf k_i-\mathbf k_j)\cdot\mathbf r_p}.[tji(3)​]ab​=[i=j]w−1δab​+2πkkjz​1​p∑​[Ap​(k−1kj​,k−1ki​)]ab​ei(ki​−kj​)⋅rp​.

Both prefactors become 000 if their denominators vanish.

3×33\times33×3 reflection matrix rji(3)r^{(3)}_{ji}rji(3)​. Its (a,b)(a,b)(a,b) entry is

[rji(3)]ab=12πk kjz∑p[Ap(k−1k~j, k−1ki)]ab e i(ki−k~j)⋅rp.\big[r^{(3)}_{ji}\big]_{ab}=\frac{1}{2\pi k\,k_{jz}}\sum_p \big[A_p(k^{-1}\tilde{\mathbf k}_j,\,k^{-1}\mathbf k_i)\big]_{ab}\,e^{\,\mathrm i(\mathbf k_i-\tilde{\mathbf k}_j)\cdot\mathbf r_p}.[rji(3)​]ab​=2πkkjz​1​p∑​[Ap​(k−1k~j​,k−1ki​)]ab​ei(ki​−k~j​)⋅rp​.

tNormji\mathsf{tNorm}_{ji}tNormji​ and rNormji\mathsf{rNorm}_{ji}rNormji​. These are 2×22\times 22×2 complex matrices:

tNormji=kjz/kiz  w  red⁡ ⁣(tji(3); k−1ki, k−1kj),\mathsf{tNorm}_{ji}=\sqrt{k_{jz}/k_{iz}}\;w\;\operatorname{red}\!\big(t^{(3)}_{ji};\,k^{-1}\mathbf k_i,\,k^{-1}\mathbf k_j\big),tNormji​=kjz​/kiz​​wred(tji(3)​;k−1ki​,k−1kj​), rNormji=kjz/kiz  w  red⁡ ⁣(rji(3); k−1ki, k−1k~j).\mathsf{rNorm}_{ji}=\sqrt{k_{jz}/k_{iz}}\;w\;\operatorname{red}\!\big(r^{(3)}_{ji};\,k^{-1}\mathbf k_i,\,k^{-1}\tilde{\mathbf k}_j\big).rNormji​=kjz​/kiz​​wred(rji(3)​;k−1ki​,k−1k~j​).

These are separate definitions. Nothing in the code relates them to tˉji\bar t_{ji}tˉji​ and rˉji\bar r_{ji}rˉji​ below.

Reduced single-particle matrix Aji\mathcal A_{ji}Aji​. For an amplitude function XXX and families of vectors (viin)(v^{\rm in}_i)(viin​), (vjout)(v^{\rm out}_j)(vjout​) in R3\mathbb R^3R3,

Aji(X;vin,vout)=red⁡ ⁣(X(k−1vjout, k−1viin);  k−1viin,  k−1vjout).\mathcal A_{ji}(X;v^{\rm in},v^{\rm out})=\operatorname{red}\!\big(X(k^{-1}v^{\rm out}_j,\,k^{-1}v^{\rm in}_i);\;k^{-1}v^{\rm in}_i,\;k^{-1}v^{\rm out}_j\big).Aji​(X;vin,vout)=red(X(k−1vjout​,k−1viin​);k−1viin​,k−1vjout​).

Block sum. It is defined as

Σji(vin,vout)=Cji∑pe i(viin−vjout)⋅rp Aji(Ap;vin,vout).\Sigma_{ji}(v^{\rm in},v^{\rm out})=C_{ji}\sum_p e^{\,\mathrm i(v^{\rm in}_i-v^{\rm out}_j)\cdot\mathbf r_p}\,\mathcal A_{ji}(A_p;v^{\rm in},v^{\rm out}).Σji​(vin,vout)=Cji​p∑​ei(viin​−vjout​)⋅rp​Aji​(Ap​;vin,vout).

Normalized blocks. These are the four 2×22\times22×2 complex matrices below, where I2I_2I2​ is the 2×22\times 22×2 identity:

tˉji=[i=j] I2+Σji(k,k),rˉji=Σji(k,k~),\bar t_{ji}=[i=j]\,I_2+\Sigma_{ji}(\mathbf k,\mathbf k),\qquad \bar r_{ji}=\Sigma_{ji}(\mathbf k,\tilde{\mathbf k}),tˉji​=[i=j]I2​+Σji​(k,k),rˉji​=Σji​(k,k~), tˉji′=[i=j] I2+Σji(k~,k~),rˉji′=Σji(k~,k).\bar t'_{ji}=[i=j]\,I_2+\Sigma_{ji}(\tilde{\mathbf k},\tilde{\mathbf k}),\qquad \bar r'_{ji}=\Sigma_{ji}(\tilde{\mathbf k},\mathbf k).tˉji′​=[i=j]I2​+Σji​(k~,k~),rˉji′​=Σji​(k~,k).

Assembly. Combined indices are pairs (j,m)(j,m)(j,m) with j∈Ij\in\mathcal Ij∈I and m∈{0,1}m\in\{0,1\}m∈{0,1}; there are 2(2Nk+1)2(2N_k+1)2(2Nk​+1) of them. Given 2×22\times22×2 blocks BjiB_{ji}Bji​, the assembled matrix has entries

[B](j,m),(i,n)=[Bji]mn.[\mathcal B]_{(j,m),(i,n)}=[B_{ji}]_{mn}.[B](j,m),(i,n)​=[Bji​]mn​.

Scattering matrix Sˉ\bar SSˉ. It is the square matrix indexed by two copies of the combined index set:

Sˉ=(RˉTˉ′TˉRˉ′).\bar S=\begin{pmatrix}\bar{\mathcal R}&\bar{\mathcal T}'\\ \bar{\mathcal T}&\bar{\mathcal R}'\end{pmatrix}.Sˉ=(RˉTˉ​Tˉ′Rˉ′​).

Here Rˉ,Tˉ′,Tˉ,Rˉ′\bar{\mathcal R},\bar{\mathcal T}',\bar{\mathcal T},\bar{\mathcal R}'Rˉ,Tˉ′,Tˉ,Rˉ′ are the assemblies of rˉ,tˉ′,tˉ,rˉ′\bar r,\bar t',\bar t,\bar r'rˉ,tˉ′,tˉ,rˉ′.


Slab ensemble (IsSlabEnsemble\mathsf{IsSlabEnsemble}IsSlabEnsemble). The inputs are:

  • a mode set KKK;
  • reals ΔL\Delta LΔL and nnn;
  • a measure PPP on a measurable space Ω\OmegaΩ;
  • for each particle p<Np<Np<N, a random centre rp:Ω→R3\mathbf r_p:\Omega\to\mathbb R^3rp​:Ω→R3 with coordinates (xp,yp,zp)(x_p,y_p,z_p)(xp​,yp​,zp​);
  • for each p<Np<Np<N, a random amplitude function ApA_pAp​ on Ω\OmegaΩ.

The condition holds when all of the following are true:

  1. PPP is a probability measure.
  2. ΔL>0\Delta L>0ΔL>0 and n>0n>0n>0.
  3. Every rp\mathbf r_prp​ and every ApA_pAp​ is measurable.
  4. The pairs (rp,Ap)(\mathbf r_p,A_p)(rp​,Ap​), p<Np<Np<N, are mutually independent.
  5. For each ppp, rp\mathbf r_prp​ is independent of ApA_pAp​.
  6. All ApA_pAp​ have the same law. No such condition is imposed on the rp\mathbf r_prp​.
  7. For every ppp, every pair of vectors u,u′u,u'u,u′ and every entry (a,b)(a,b)(a,b), the random variable [Ap(u,u′)]ab[A_p(u,u')]_{ab}[Ap​(u,u′)]ab​ is square-integrable.
  8. For each ppp, (xp,yp)(x_p,y_p)(xp​,yp​) is independent of zpz_pzp​.
  9. Each zpz_pzp​ is uniformly distributed on [−ΔL/2,ΔL/2][-\Delta L/2,\Delta L/2][−ΔL/2,ΔL/2].
  10. For every ppp and every i,j,u,v∈Ii,j,u,v\in\mathcal Ii,j,u,v∈I, with
q=(kix−kjx−kux+kvx,  kiy−kjy−kuy+kvy),q=(k_{ix}-k_{jx}-k_{ux}+k_{vx},\;k_{iy}-k_{jy}-k_{uy}+k_{vy}),q=(kix​−kjx​−kux​+kvx​,kiy​−kjy​−kuy​+kvy​),

the following holds:

N EP ⁣[e i(qxxp+qyyp)]={(2π)2n ΔL/w,q=0,0,q≠0.N\,\mathbb E_P\!\left[e^{\,\mathrm i(q_x x_p+q_y y_p)}\right]=\begin{cases}(2\pi)^2 n\,\Delta L/w,& q=0,\\ 0,& q\neq0.\end{cases}NEP​[ei(qx​xp​+qy​yp​)]={(2π)2nΔL/w,0,​q=0,q=0.​

Consequences of these conditions:

  • When N=0N=0N=0: every per-particle condition is vacuous.
  • The q=0q=0q=0 case: taking i=j=u=vi=j=u=vi=j=u=v always gives q=0q=0q=0. The left side is then NNN, so for N≥1N\ge1N≥1 the condition forces the exact identity N=(2π)2nΔL/wN=(2\pi)^2n\Delta L/wN=(2π)2nΔL/w. If w=0w=0w=0, the right side is 000, which is impossible for N≥1N\ge1N≥1.
  • The q≠0q\neq0q=0 case: for every nonzero qqq of the displayed form, the characteristic function of (xp,yp)(x_p,y_p)(xp​,yp​) must vanish exactly at qqq.
  • Validity: KKK is not required to be valid.

Covariance. For complex random variables X,YX,YX,Y on (Ω,P)(\Omega,P)(Ω,P),

cov⁡(X,Y)=E[XY‾]−E[X] E[Y]‾.\operatorname{cov}(X,Y)=\mathbb E[X\overline Y]-\mathbb E[X]\,\overline{\mathbb E[Y]}.cov(X,Y)=E[XY]−E[X]E[Y]​.

Pseudo-covariance. It is defined as

pcov⁡(X,Y)=E[XY]−E[X] E[Y].\operatorname{pcov}(X,Y)=\mathbb E[XY]-\mathbb E[X]\,\mathbb E[Y].pcov(X,Y)=E[XY]−E[X]E[Y].

In both formulas, any expectation of a non-integrable function is taken to be 000. No integrability is assumed.

Shift along zzz. For a real L0L_0L0​, the shift replaces each centre rp\mathbf r_prp​ by rp+(0,0,L0)\mathbf r_p+(0,0,L_0)rp​+(0,0,L0​).

Phase matrices. For real L0L_0L0​, the following are defined on the combined index set:

Λ+L0=diag⁡i∈I(e ikizL0)⊗I2,Λ−L0=Λ+L0‾ (entrywise conjugate),\Lambda_+^{L_0}=\operatorname{diag}_{i\in\mathcal I}\big(e^{\,\mathrm i k_{iz}L_0}\big)\otimes I_2,\qquad \Lambda_-^{L_0}=\overline{\Lambda_+^{L_0}}\ \text{(entrywise conjugate)},Λ+L0​​=diagi∈I​(eikiz​L0​)⊗I2​,Λ−L0​​=Λ+L0​​​ (entrywise conjugate), Λ±L0=(Λ+L000Λ−L0),Λ∓L0=Λ±L0‾=(Λ−L000Λ+L0).\Lambda_\pm^{L_0}=\begin{pmatrix}\Lambda_+^{L_0}&0\\0&\Lambda_-^{L_0}\end{pmatrix},\qquad \Lambda_\mp^{L_0}=\overline{\Lambda_\pm^{L_0}}=\begin{pmatrix}\Lambda_-^{L_0}&0\\0&\Lambda_+^{L_0}\end{pmatrix}.Λ±L0​​=(Λ+L0​​0​0Λ−L0​​​),Λ∓L0​​=Λ±L0​​​=(Λ−L0​​0​0Λ+L0​​​).

The second form of Λ∓L0\Lambda_\mp^{L_0}Λ∓L0​​ holds because conjugating twice returns Λ+L0\Lambda_+^{L_0}Λ+L0​​.


Transfer matrix. Let VVV be any finite index set, and write a square complex matrix indexed by two copies of VVV in blocks as

S=(S11S12S21S22).S=\begin{pmatrix}S_{11}&S_{12}\\S_{21}&S_{22}\end{pmatrix}.S=(S11​S21​​S12​S22​​).

Its transfer matrix is

M(S)=(S21−S22S12−1S11S22S12−1−S12−1S11S12−1).M(S)=\begin{pmatrix}S_{21}-S_{22}S_{12}^{-1}S_{11}& S_{22}S_{12}^{-1}\\ -S_{12}^{-1}S_{11}& S_{12}^{-1}\end{pmatrix}.M(S)=(S21​−S22​S12−1​S11​−S12−1​S11​​S22​S12−1​S12−1​​).

Here S12−1S_{12}^{-1}S12−1​ denotes the matrix inverse when S12S_{12}S12​ is invertible and the zero matrix otherwise. So for singular S12S_{12}S12​, the formula gives

M(S)=(S21000).M(S)=\begin{pmatrix}S_{21}&0\\0&0\end{pmatrix}.M(S)=(S21​0​00​).

Exchange and Pauli matrices. The exchange matrix JnJ_nJn​ is the n×nn\times nn×n matrix with (Jn)ab=1(J_n)_{ab}=1(Jn​)ab​=1 if a=n−1−ba=n-1-ba=n−1−b and 000 otherwise. Also σz=diag⁡(1,−1)\sigma_z=\operatorname{diag}(1,-1)σz​=diag(1,−1), and

Π0=J2Nk+1⊗σz,[Π0](j,m),(i,n)=[ j=iˉ ] (σz)mn.\Pi_0=J_{2N_k+1}\otimes\sigma_z,\qquad [\Pi_0]_{(j,m),(i,n)}=[\,j=\bar i\,]\,(\sigma_z)_{mn}.Π0​=J2Nk​+1​⊗σz​,[Π0​](j,m),(i,n)​=[j=iˉ](σz​)mn​.

Reciprocity (IsReciprocal\mathsf{IsReciprocal}IsReciprocal). A square complex matrix SSS indexed by two copies of the combined index set is reciprocal when

S=Π ST Π,Π=(Π000Π0),S=\Pi\,S^{\mathsf T}\,\Pi,\qquad \Pi=\begin{pmatrix}\Pi_0&0\\0&\Pi_0\end{pmatrix},S=ΠSTΠ,Π=(Π0​0​0Π0​​),

where STS^{\mathsf T}ST is the plain transpose, with no conjugation.

Cascade (IsCascade\mathsf{IsCascade}IsCascade). For three square complex matrices S1,S2,SS_1,S_2,SS1​,S2​,S indexed by two copies of a finite set VVV, write the blocks of SℓS_\ellSℓ​ as

Sℓ=(rℓtℓ′tℓrℓ′).S_\ell=\begin{pmatrix}r_\ell&t'_\ell\\ t_\ell&r'_\ell\end{pmatrix}.Sℓ​=(rℓ​tℓ​​tℓ′​rℓ′​​).

SSS is a cascade of S1S_1S1​ and S2S_2S2​ when, for all vectors a,d∈CVa,d\in\mathbb C^Va,d∈CV, there exist b,c∈CVb,c\in\mathbb C^Vb,c∈CV such that

b=t1a+r1′c,c=r2b+t2′d,S(ad)=(r1a+t1′ct2b+r2′d).b=t_1a+r_1'c,\qquad c=r_2b+t_2'd,\qquad S\begin{pmatrix}a\\d\end{pmatrix}=\begin{pmatrix}r_1a+t_1'c\\ t_2b+r_2'd\end{pmatrix}.b=t1​a+r1′​c,c=r2​b+t2′​d,S(ad​)=(r1​a+t1′​ct2​b+r2′​d​).

Consequences of these conditions:

  • Existence only: the code requires that some pair (b,c)(b,c)(b,c) exists. It does not require that (b,c)(b,c)(b,c) be unique.
  • When the system has no solution: if the first two equations have no solution for some (a,d)(a,d)(a,d), then the condition fails for every SSS.

Scattering-plane frame. For ui,uj∈R3u_i,u_j\in\mathbb R^3ui​,uj​∈R3, not assumed unit, define e⊥\mathbf e_\perpe⊥​, e∥,i\mathbf e_{\parallel,i}e∥,i​ and e∥,j\mathbf e_{\parallel,j}e∥,j​ in two cases:

  • "Parallel" case, ui×uj=0u_i\times u_j=0ui​×uj​=0: this includes uiu_iui​ and uju_juj​ antiparallel and either one zero. Then
e⊥=eφ(ui),e∥,i=eθ(ui),e∥,j=eθ(uj).\mathbf e_\perp=\mathbf e_\varphi(u_i),\qquad \mathbf e_{\parallel,i}=\mathbf e_\theta(u_i),\qquad \mathbf e_{\parallel,j}=\mathbf e_\theta(u_j).e⊥​=eφ​(ui​),e∥,i​=eθ​(ui​),e∥,j​=eθ​(uj​).
  • Otherwise:
e⊥=ui×uj^,e∥,i=e⊥×ui,e∥,j=e⊥×uj.\mathbf e_\perp=\widehat{u_i\times u_j},\qquad \mathbf e_{\parallel,i}=\mathbf e_\perp\times u_i,\qquad \mathbf e_{\parallel,j}=\mathbf e_\perp\times u_j.e⊥​=ui​×uj​​,e∥,i​=e⊥​×ui​,e∥,j​=e⊥​×uj​.

The last two vectors are not normalized.

Signed angle. For vectors eθ,e∥,ek∈R3\mathbf e_\theta,\mathbf e_\parallel,\mathbf e_k\in\mathbb R^3eθ​,e∥​,ek​∈R3, the signed angle is

θ=arg⁡ ⁣(eθ⋅e∥+i (eθ×e∥)⋅ek)∈(−π,π].\theta=\arg\!\big(\mathbf e_\theta\cdot\mathbf e_\parallel+\mathrm i\,(\mathbf e_\theta\times\mathbf e_\parallel)\cdot\mathbf e_k\big)\in(-\pi,\pi].θ=arg(eθ​⋅e∥​+i(eθ​×e∥​)⋅ek​)∈(−π,π].

It equals 000 when both components vanish. No orthonormality of the inputs is assumed.

Rotation matrix. For real ttt, it is the complex matrix

R(t)=(cos⁡tsin⁡t−sin⁡tcos⁡t).R(t)=\begin{pmatrix}\cos t&\sin t\\-\sin t&\cos t\end{pmatrix}.R(t)=(cost−sint​sintcost​).

Scattering-plane amplitude matrix. For a complex 3×33\times33×3 matrix XXX and vectors ui,uju_i,u_jui​,uj​, it is the 2×22\times22×2 complex matrix

[S(X;ui,uj)]mn=fmT X gn,(f0,f1)=(e∥,j,−e⊥),(g0,g1)=(e∥,i,−e⊥).[\mathcal S(X;u_i,u_j)]_{mn}=f_m^{\mathsf T}\,X\,g_n,\qquad (f_0,f_1)=(\mathbf e_{\parallel,j},-\mathbf e_\perp),\quad (g_0,g_1)=(\mathbf e_{\parallel,i},-\mathbf e_\perp).[S(X;ui​,uj​)]mn​=fmT​Xgn​,(f0​,f1​)=(e∥,j​,−e⊥​),(g0​,g1​)=(e∥,i​,−e⊥​).

All three vectors are those of the frame built from ui,uju_i,u_jui​,uj​.

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

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 25, 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