Echo energy, vessel power law, amplitude histogram and Burr density (Parker 2019)
DefinitionArxiv1906_02603_BasicObjects of Sections II, IV, V and the Appendix of Parker (2019), The first order statistics of backscatter from the fractal branching vasculature.
- Bessel function. , the Bessel function of the first kind of order one (Bessel's integral).
- Echo of one cylinder (eq. 6). For beam widths and compressibility contrast , the echo energy of a long cylinder of radius perpendicular to the propagation direction is the right-hand side of eq. (6),
and the RMS echo amplitude is . 3. Vessel population and amplitude map. The number density of vessels of radius is , and the envelope amplitude of a vessel of radius is . 4. Histograms. The amplitude histogram (eq. 8) is ; its normalization (eq. 9) is . 5. Burr density (eq. 10). With , . The Burr Type XII density with shapes and scale is . 6. Moments, SNR and CDF (eqs. 11-14). , , and . 7. Rayleigh density (eq. 15). . 8. Appendix example. The envelope and the function .
Formalization Note The paper uses without defining it; Mathlib has no Bessel functions, so is defined by Bessel's integral (Abramowitz and Stegun 9.1.21). The integral in eq. (6) is a Lebesgue integral over ; its integrand is integrable for . Real powers are Real.rpow, and the definitions are total; they are evaluated at nonpositive bases only off the relevant domains (e.g. on null sets of a measure, or away from the limit point), so only values at positive bases affect the statements.
import Mathlib
/-!
K. J. Parker, *The first order statistics of backscatter from the fractal branching vasculature*,
arXiv:1906.02603v3 (2019): the RMS echo of a cylinder (Section II, eqs. (4)-(6)), the power-law
vessel population and its amplitude histogram (Section II, eqs. (7)-(13)), the Burr CDF and the
Rayleigh density (Section IV, eqs. (14)-(15)), and the envelope example of the Appendix
(eq. (16) and the example after it).
-/
open MeasureTheory
noncomputable section
namespace Arxiv1906_02603
/-- The Bessel function of the first kind of order one, `J₁`, used in the cylinder transform of
eq. (4) (Section II, p. 6), given by Bessel's integral
`J₁(x) = (1/π) ∫₀^π cos(τ - x sin τ) dτ` (Abramowitz and Stegun 9.1.21, cited by the paper). -/
def besselJ1 (x : ℝ) : ℝ :=
(1 / Real.pi) * ∫ τ in (0 : ℝ)..Real.pi, Real.cos (τ - x * Real.sin τ)
/-- Section II, eqs. (3), (5), (6) (pp. 5, 8): the factor
`8 exp[-π²(k_x² σ_x² + 2 k_y² σ_y²)] k_x² π^{7/2} σ_x³ σ_y` of eq. (6), i.e. the spatial Fourier
transform of the GH2 pulse with Gaussian beam profiles, evaluated at `k_z = 0` with the factor
`σ_z` taken out. -/
def pulseFactor (sx sy kx ky : ℝ) : ℝ :=
8 * Real.exp (-(Real.pi ^ 2 * (kx ^ 2 * sx ^ 2 + 2 * ky ^ 2 * sy ^ 2))) * kx ^ 2 *
Real.pi ^ ((7 : ℝ) / 2) * sx ^ 3 * sy
/-- Section II, eqs. (4)-(6) (pp. 6, 8): the cylinder factor
`a · (1/√(k_x²+k_y²)) · J₁(2 a π √(k_x²+k_y²))` of a cylinder of radius `a` (its 2D transform
`F(ρ) = κ₀ a J₁(2π a ρ)/ρ` with `κ₀` taken out). -/
def cylinderFactor (a kx ky : ℝ) : ℝ :=
a * (1 / Real.sqrt (kx ^ 2 + ky ^ 2)) * besselJ1 (2 * a * Real.pi * Real.sqrt (kx ^ 2 + ky ^ 2))
/-- Section II, eq. (6) (p. 8): the echo energy of one long cylinder of radius `a` perpendicular
to the propagation direction, defined as the right-hand side of eq. (6),
`σ_z² κ₀² ∬ (pulse factor)² (k_x²)² (cylinder factor)² dk_x dk_y` over `ℝ²`. -/
def echoEnergy (sx sy sz kappa0 a : ℝ) : ℝ :=
sz ^ 2 * kappa0 ^ 2 *
∫ k : ℝ × ℝ, pulseFactor sx sy k.1 k.2 ^ 2 * (k.1 ^ 2) ^ 2 * cylinderFactor a k.1 k.2 ^ 2
/-- Section II, text after eq. (6) (p. 8): the RMS echo amplitude, the square root of the echo
energy of eq. (6), as a function of the cylinder radius `a`. -/
def rmsEcho (sx sy sz kappa0 a : ℝ) : ℝ :=
Real.sqrt (echoEnergy sx sy sz kappa0 a)
/-- Section II, p. 10 (and Section I, p. 4): the power-law number density of vessels of radius
`a`, `N[a] = N₀ / a^b`. -/
def vesselDensity (N0 b a : ℝ) : ℝ :=
N0 * a ^ (-b)
/-- Section II, p. 10: the square-root map from cylinder radius to envelope amplitude,
`A[a] = A₀ √(a - a_min)` for `a > a_min`. -/
def amplitudeOfRadius (A0 amin a : ℝ) : ℝ :=
A0 * Real.sqrt (a - amin)
/-- Section II, eq. (8) (p. 10): the histogram of envelope amplitudes
`N[A] = 2 N₀ A / (A₀² [(A/A₀)² + a_min]^b)`. -/
def ampHist (N0 A0 amin b A : ℝ) : ℝ :=
2 * N0 * A / (A0 ^ 2 * ((A / A0) ^ 2 + amin) ^ b)
/-- Section II, eq. (9) (p. 11): the normalized histogram
`N_n[A] = 2 A a_min^{b-1} (b-1) / (A₀² [(A/A₀)² + a_min]^b)`. -/
def normHist (A0 amin b A : ℝ) : ℝ :=
2 * A * amin ^ (b - 1) * (b - 1) / (A0 ^ 2 * ((A / A0) ^ 2 + amin) ^ b)
/-- Section II, p. 11: the scale parameter `λ = A₀ √a_min` of eq. (10). -/
def burrScale (A0 amin : ℝ) : ℝ :=
A0 * Real.sqrt amin
/-- Section II, eq. (10) (p. 11): the two-parameter density
`N_n[A] = 2 A (b-1) / (λ² [(A/λ)² + 1]^b)`. -/
def burrPdf (lam b A : ℝ) : ℝ :=
2 * A * (b - 1) / (lam ^ 2 * ((A / lam) ^ 2 + 1) ^ b)
/-- Section II, p. 11: the Burr Type XII density with shape parameters `c, k` and scale `λ`
(Burr 1942; Rodriguez 1977, cited by the paper),
`f(x) = (c k / λ) (x/λ)^{c-1} (1 + (x/λ)^c)^{-(k+1)}` for `x > 0`. -/
def burrXIIPdf (c k lam x : ℝ) : ℝ :=
c * k / lam * (x / lam) ^ (c - 1) * (1 + (x / lam) ^ c) ^ (-(k + 1))
/-- Section II, eqs. (11)-(12) (p. 12): the `n`-th moment `⟨Aⁿ⟩ = ∫₀^∞ Aⁿ N_n[A] dA` of the
density of eq. (10). -/
def burrMoment (lam b : ℝ) (n : ℕ) : ℝ :=
∫ A in Set.Ioi (0 : ℝ), A ^ n * burrPdf lam b A
/-- Section II, eq. (13) (p. 12): the signal-to-noise ratio `SNR = ⟨A⟩ / σ_A` of the density of
eq. (10), the mean over the standard deviation, with `σ_A² = ⟨A²⟩ - ⟨A⟩²`. -/
def burrSNR (lam b : ℝ) : ℝ :=
burrMoment lam b 1 / Real.sqrt (burrMoment lam b 2 - burrMoment lam b 1 ^ 2)
/-- Section IV, eq. (14) (p. 15): the Burr cumulative distribution function
`CDF(A) = 1 - [1 + (A/λ)²]^{-(b-1)}`. -/
def burrCdf (lam b A : ℝ) : ℝ :=
1 - (1 + (A / lam) ^ 2) ^ (-(b - 1))
/-- Section IV, eq. (15) (p. 16): the Rayleigh density `R[A] = (A/S²) exp(-A²/(2S²))`. -/
def rayleighPdf (S A : ℝ) : ℝ :=
A / S ^ 2 * Real.exp (-(A ^ 2 / (2 * S ^ 2)))
/-- Appendix, example after eq. (16) (p. 20): the envelope `y = A₁ (1 - x²)`. -/
def appendixEnvelope (A1 x : ℝ) : ℝ :=
A1 * (1 - x ^ 2)
/-- Appendix, example after eq. (16) (p. 21): the histogram of the sampled envelope,
`f(y) = 1 / (2 A₁ √(1 - y/A₁))` for `0 < y < A₁`. -/
def appendixHist (A1 y : ℝ) : ℝ :=
1 / (2 * A1 * Real.sqrt (1 - y / A1))
end Arxiv1906_02603
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
besselJ1. For every real number (no restrictions), this defines
an ordinary integral over of a continuous function. It is a genuine real number for every .
pulseFactor. For arbitrary real numbers , with no positivity or nonzero assumptions, this defines
The powers and are ordinary integer powers, so the sign of and carries through. The value is whenever , or .
cylinderFactor. For arbitrary real numbers , where may be zero or negative, write . This defines
where is the Bessel integral defined in besselJ1 above. Division by zero is taken to equal . Consequently, at the factor is and , rather than any limiting value.
echoEnergy. For arbitrary real numbers , with no sign restrictions, this defines
Here and are as in pulseFactor and cylinderFactor, and the integral is the Lebesgue integral over the whole plane with respect to two-dimensional Lebesgue measure. If the integrand is not integrable, the integral is taken to be . The integrand is a product of squares and , hence nonnegative.
rmsEcho. For the same arbitrary real inputs , this defines
the square root of the quantity from echoEnergy. The real square root used returns on negative arguments.
vesselDensity. For arbitrary real numbers , this defines
where is the real power function. Its behaviour off the positive axis is fixed by convention:
- For it is the usual .
- For it equals if and if .
- For it equals .
No restriction to positive radii is imposed.
amplitudeOfRadius. For arbitrary real numbers , this defines
It is defined for all , not only for . The square root returns for negative arguments, so whenever .
ampHist. For arbitrary real numbers , this defines
The power uses the real power function with the conventions stated under vesselDensity:
- A zero base gives if and if .
- A negative base is possible when , and then gives .
Division by zero gives , so the value is when (since then and the denominator has the factor ). The value is also whenever the bracketed power vanishes. may be negative.
normHist. For arbitrary real numbers , this defines
Both and are real powers with the conventions above for zero or negative bases. Division by zero gives , so yields . There are no assumptions such as , , or .
burrScale. For arbitrary real numbers , this defines
with returning on negative arguments, so when .
burrPdf. For arbitrary real numbers , this defines
The base is always positive, so the real power is the usual one. Division by zero gives , so when . The function is defined for all real , including negative , where it is negative if . There are no assumptions on or .
burrXIIPdf. For arbitrary real numbers , this defines
All three powers are real powers with the conventions for zero or negative bases stated under vesselDensity:
- A zero base gives , or when the exponent is .
- A negative base gives .
Division by zero gives , so the value is when . The function is defined for all real , not only , and there are no assumptions on , or .
burrMoment. For arbitrary real numbers and a natural number (so is allowed), this defines
where is the function from burrPdf. The integral is the Lebesgue integral over the open half-line. If the integrand is not Lebesgue integrable there (for instance, for parameter values where the tail decays too slowly), the integral is taken to be . No condition on or is imposed, and is not required to integrate to .
burrSNR. For arbitrary real numbers , this defines
using the moments from burrMoment, including their "non-integrable gives " convention. The square root returns on negative arguments, and division by zero gives . So the value is whenever .
burrCdf. For arbitrary real numbers , this defines
The base is at least , so the power is the usual real power. Division by zero gives , so yields for every . The function is defined for all real , including negative , where it is symmetric in . There are no assumptions on .
rayleighPdf. For arbitrary real numbers , this defines
Division by zero gives , so for all . It is defined for all real , including negative , where it is negative.
appendixEnvelope. For arbitrary real numbers , this defines
with no restriction of to an interval.
appendixHist. For arbitrary real numbers , this defines
It is defined for all , not just . The square root returns on negative arguments and division by zero gives , which has these consequences:
- If , then , the denominator is , and .
- Whenever (for this means ), .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.