polygon_area

std.geometry.polygon_area · Level L2

Signed area of a polygon by the shoelace formula: positive when the vertices run counter-clockwise. The next vertex of each one comes from joining P[1:] and P[:1].

½·Σᵢ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ), index n ≡ 0

Signature

polygon_area(P: f64[n, 2]) → f64[]

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.

Pf64[n, 2]SlicerestSlicefirstSlicexSliceyConcatQSliceynSlicexnMultiplyaMultiplycSubtractcrossReduceSumtotal2.0Divideareaareaf64[]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Equal to the reference 0.5 * np.sum(x * np.roll(y, -1) - np.roll(x, -1) * y) in exact rational arithmetic, on all 40 test cases.
  • All 40 float64 results inside the running error bound; the closest uses 24% of it.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
85%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
17

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:77cfdb73ef5ad13aaeae438c80ec03f77bdb52044963dd314703a127c1bf8399

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

Control handle

Symbol
Ω:std.geometry.polygon_area · Ω:polygon_area
Pins
sha256:c605d864ad1593256c0a393f555d573b5a28d3b116e1048d08cd47c1667aad19this graph alone
Evidence
sha256:2a4ca5e5baf8a1cd685d56400287074dddd7adfa9af12bffdfdf792c119f3bffthe 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.