trimmed_mean

std.stats.trimmed_mean · Level L2

Mean without the smallest and the largest value, which makes it resistant to one outlier at each end.

(1/(n − 2))·Σ₁≤ᵢ≤ₙ₋₂ x₍ᵢ₎

Signature

trimmed_mean(x: f64[n]) → f64[]

Requires: n ≥ 3

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

xf64[n]SortsSizen2.0SliceinnerSubtractkeptReduceSumtotalDividemmf64[]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size with n ≥ 3.
  • Equal to the reference np.mean(np.sort(x)[1:-1]) in exact rational arithmetic, on all 40 test cases.
  • All 40 float64 results inside the running error bound; the closest uses 50% of it.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
93%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
1.29

Identity

Calls
—
Called by
—
sha256:bd5d2e3e95ccc3ca696a5286517f2897468e236f9882ab4d79d82c3109991588

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.

Control handle

Symbol
Ω:std.stats.trimmed_mean · Ω:trimmed_mean
Pins
sha256:afcd0a292ea22213d9418f2a7244c90de33b1db3292306606b7a2e7adabe8569this graph alone
Evidence
sha256:5083fe1da6412ccd4787ed448b25e9f6b98b3a011103bdc95c446034077fb2d0the hash of its verification record
Needs
no capability: a pure function

Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.