moving_average3

std.seq.moving_average3 · Level L2

Moving average over a window of three, at every position where the window fits.

yᵢ = (xᵢ + xᵢ₊₁ + xᵢ₊₂)/3

Signature

moving_average3(x: f64[n]) → f64[n−2]

Requires: n ≥ 2

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]SliceaSlicemSlicezAddamAddamz3.0Divideyyf64[n−2]
  • input
  • operation
  • constant
  • call
  • output

Verification

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

Large ulp counts appear where a result is tiny next to the numbers it is computed from (after cancellation, for example), so one unit in the last place is tiny too; the absolute error is still inside the bound. Results within their own error of zero are not counted.

Identity

Calls
—
Called by
—
sha256:f16a5351a286ceb15986ca299bc11116ff6d6989f25e3416235aec7236f7b72b

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

Control handle

Symbol
Ω:std.seq.moving_average3 · Ω:moving_average3
Pins
sha256:ba9a78d71e5596670d763c302e04c06b87d857ebea14f3820be4ddb3644d6c99this graph alone
Evidence
sha256:ec1b7216b85255c7196d3eab6296b5ea0a578d4af4ca1b0ae26ea9e989b686bethe 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.