FAILURE MAP
← Case archive

FA-6431 / Discrete calculus / Open access

Piecewise linear slope sequence · case 01

The sample spacing is ignored.

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

ROOT CAUSE

The sample spacing is ignored.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return [str(Fraction(v-u,b-a)) for a,b,u,v in zip(x,x[1:],y,y[1:])]

Unsuccessful approach: The reciprocal slope swaps dependent and independent axes.

Case contract

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. x and y lengths match and neighboring x values are distinct; return each segment slope. Exact operational definition: [str(Fraction(v-u,b-a)) for a,b,u,v in zip(x,x[1:],y,y[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(x, y):
    return [str(v-u) for u,v in zip(y,y[1:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([0, 2, 3], [0, 4, 5])', solve(*([0, 2, 3], [0, 4, 5])), ['2', '1'])
check('fixture 2: ([1, 3], [2, 2])', solve(*([1, 3], [2, 2])), ['0'])
check('fixture 3: ([0, 2], [4, 0])', solve(*([0, 2], [4, 0])), ['-2'])
check('fixture 4: ([1], [5])', solve(*([1], [5])), [])
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, 3], [0, 4, 5])['4', '1']['2', '1']Failed
fixture 2: ([1, 3], [2, 2])['0']['0']Passed
fixture 3: ([0, 2], [4, 0])['-4']['-2']Failed
fixture 4: ([1], [5])[][]Passed

SHA-256 / 8da810491a1ce76420a7ca3a6178ace2d8b32cfa6e3c70cb8b4714db47263132

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(x, y):
    return [str(Fraction(b-a,v-u)) if v!=u else None for a,b,u,v in zip(x,x[1:],y,y[1:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([0, 2, 3], [0, 4, 5])', solve(*([0, 2, 3], [0, 4, 5])), ['2', '1'])
check('fixture 2: ([1, 3], [2, 2])', solve(*([1, 3], [2, 2])), ['0'])
check('fixture 3: ([0, 2], [4, 0])', solve(*([0, 2], [4, 0])), ['-2'])
check('fixture 4: ([1], [5])', solve(*([1], [5])), [])
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, 3], [0, 4, 5])['1/2', '1']['2', '1']Failed
fixture 2: ([1, 3], [2, 2])[None]['0']Failed
fixture 3: ([0, 2], [4, 0])['-1/2']['-2']Failed
fixture 4: ([1], [5])[][]Passed

SHA-256 / 3043004b1134a37a6bf805c744e5b08e01435b3cf04b2d5a46d17dd664e87682

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(x, y):
    return [str(Fraction(v-u,b-a)) for a,b,u,v in zip(x,x[1:],y,y[1:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([0, 2, 3], [0, 4, 5])', solve(*([0, 2, 3], [0, 4, 5])), ['2', '1'])
check('fixture 2: ([1, 3], [2, 2])', solve(*([1, 3], [2, 2])), ['0'])
check('fixture 3: ([0, 2], [4, 0])', solve(*([0, 2], [4, 0])), ['-2'])
check('fixture 4: ([1], [5])', solve(*([1], [5])), [])
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, 3], [0, 4, 5])['2', '1']['2', '1']Passed
fixture 2: ([1, 3], [2, 2])['0']['0']Passed
fixture 3: ([0, 2], [4, 0])['-2']['-2']Passed
fixture 4: ([1], [5])[][]Passed

SHA-256 / c2cf8b7518492eab25d2093805b0bc83479fbd7f09c29fad153c8fb7b9428261

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.672532+00:00.

Case digest / 8367fa25b214cbe8cd1e3d5c503848d17101abe4e20f659c51c953d49d8acaf8