FAILURE MAP
← Case archive

FA-6426 / Discrete calculus / Open access

Discrete total variation · case 01

Net displacement cancels intermediate variation.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Net displacement cancels intermediate variation.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return sum(abs(b-a) for a,b in zip(values,values[1:]))

Unsuccessful approach: Squared differences implement a different roughness measure.

Case contract

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. Discrete total variation. Exact operational definition: sum(abs(b-a) for a,b in zip(values,values[1:]))

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Discrete calculus results depend on the stated convention.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(values):
    return abs(values[-1]-values[0]) if values else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([0, 2, 0],)', solve(*([0, 2, 0],)), 4)
check('fixture 2: ([1, 4, 9],)', solve(*([1, 4, 9],)), 8)
check('fixture 3: ([5],)', solve(*([5],)), 0)
check('fixture 4: ([],)', solve(*([],)), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1: ([0, 2, 0],)04Failed
fixture 2: ([1, 4, 9],)88Passed
fixture 3: ([5],)00Passed
fixture 4: ([],)00Passed

SHA-256 / 546e51c26adf1ab18403dd384b3c49aeebb13027efa2cb13e196751257e1137a

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(values):
    return sum((b-a)**2 for a,b in zip(values,values[1:]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([0, 2, 0],)', solve(*([0, 2, 0],)), 4)
check('fixture 2: ([1, 4, 9],)', solve(*([1, 4, 9],)), 8)
check('fixture 3: ([5],)', solve(*([5],)), 0)
check('fixture 4: ([],)', solve(*([],)), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1: ([0, 2, 0],)84Failed
fixture 2: ([1, 4, 9],)348Failed
fixture 3: ([5],)00Passed
fixture 4: ([],)00Passed

SHA-256 / 064f1ab7b45c8598ffef3cf4c212ef27bac1d1c3856e674a6a3e1d05860b9663

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(values):
    return sum(abs(b-a) for a,b in zip(values,values[1:]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([0, 2, 0],)', solve(*([0, 2, 0],)), 4)
check('fixture 2: ([1, 4, 9],)', solve(*([1, 4, 9],)), 8)
check('fixture 3: ([5],)', solve(*([5],)), 0)
check('fixture 4: ([],)', solve(*([],)), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fixture 1: ([0, 2, 0],)44Passed
fixture 2: ([1, 4, 9],)88Passed
fixture 3: ([5],)00Passed
fixture 4: ([],)00Passed

SHA-256 / 4d9e4233547e53dd4591670ac938201538df267bc2f6fbe05996374c2c4ada91

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:38:01.616540+00:00.

Case digest / 52dd9e13b8bc4774ba476e8dd51e76bf4896c2be6efa2499113d7795ed5c9744