FAILURE MAP
← Case archive

FA-14696 / Numerics / Open access

Newton divided difference table: in place update direction · case 01

The exact newton divided difference table result violates the stated contract at in place update direction.

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

ROOT CAUSE

The in place update direction step uses range(order,n) instead of range(n-1,order-1,-1).

VERIFIED REPAIR

Use range(n-1,order-1,-1) at the in place update direction step.

Unsuccessful approach: The partial repair range(n-1,order,-1) still violates the in place update direction invariant.

Case contract

Input distinct integer nodes and integer values [nodes,values]; return Newton coefficients [p,q] in original node order.

Why this case matters

Exact discrete arithmetic with observable algorithmic state; no floating point approximation is used.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    nodes,values=x
    c=list(map(Fraction,values));n=len(c)
    for order in range(1,n):
     for i in range(order,n):
      den=nodes[i]-nodes[i-order]
      if den==0:return None
      c[i]=(c[i]-c[i-1])/den
    return [[v.numerator,v.denominator] for v in c]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[-2, 0, 3], [-1, -1, 0]], [[-1, 1], [0, 1], [1, 15]]), ([[-2, 0, 3], [-1, -1, 1]], [[-1, 1], [0, 1], [2, 15]]), ([[-2, 0, 3], [-1, -1, 2]], [[-1, 1], [0, 1], [1, 5]]), ([[-2, 0, 3], [-1, 0, -1]], [[-1, 1], [1, 2], [-1, 6]]), ([[-2, 0, 3], [-1, 0, 0]], [[-1, 1], [1, 2], [-1, 10]]), ([[-2, 0, 3], [-1, 0, 1]], [[-1, 1], [1, 2], [-1, 30]])], [([[-2, 0, 3], [-1, -1, 0]], [[-1, 1], [0, 1], [1, 15]]), ([[-2, 0, 3], [-1, -1, 2]], [[-1, 1], [0, 1], [1, 5]]), ([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[-2, 0, 3], [0, -1, 0]], [[0, 1], [-1, 2], [1, 6]]), ([[-2, 0, 3], [0, -1, 1]], [[0, 1], [-1, 2], [7, 30]]), ([[-2, 0, 3], [0, -1, 2]], [[0, 1], [-1, 2], [3, 10]]), ([[-2, 0, 3], [0, 0, -1]], [[0, 1], [0, 1], [-1, 15]])], [([[-2, 0, 3], [-1, -1, 1]], [[-1, 1], [0, 1], [2, 15]]), ([[-2, 0, 3], [-1, 0, 1]], [[-1, 1], [1, 2], [-1, 30]]), ([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[-2, 0, 3], [1, -1, 1]], [[1, 1], [-1, 1], [1, 3]]), ([[-2, 0, 3], [1, -1, 2]], [[1, 1], [-1, 1], [2, 5]]), ([[-2, 0, 3], [1, 0, -1]], [[1, 1], [-1, 2], [1, 30]]), ([[-2, 0, 3], [1, 0, 0]], [[1, 1], [-1, 2], [1, 10]])], [([[-2, 0, 3], [-1, -1, 2]], [[-1, 1], [0, 1], [1, 5]]), ([[-2, 0, 3], [-1, 1, 0]], [[-1, 1], [1, 1], [-4, 15]]), ([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[-2, 0, 3], [2, -1, 2]], [[2, 1], [-3, 2], [1, 2]]), ([[-2, 0, 3], [2, 0, -1]], [[2, 1], [-1, 1], [2, 15]]), ([[-2, 0, 3], [2, 0, 0]], [[2, 1], [-1, 1], [1, 5]]), ([[-2, 0, 3], [2, 0, 1]], [[2, 1], [-1, 1], [4, 15]])], [([[-2, 0, 3], [-1, 0, -1]], [[-1, 1], [1, 2], [-1, 6]]), ([[-2, 0, 3], [-1, 2, -1]], [[-1, 1], [3, 2], [-1, 2]]), ([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[0, 1, 2], [-1, 0, -1]], [[-1, 1], [1, 1], [-1, 1]]), ([[0, 1, 2], [-1, 0, 0]], [[-1, 1], [1, 1], [-1, 2]]), ([[0, 1, 2], [-1, 0, 1]], [[-1, 1], [1, 1], [0, 1]]), ([[0, 1, 2], [-1, 0, 2]], [[-1, 1], [1, 1], [1, 2]])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, solve(args), expected)
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
explicit oracle 0[[-1, 1], [0, 1], [-1, 15]][[-1, 1], [0, 1], [0, 1]]Failed
explicit oracle 1[[2, 1], [0, 1], [2, 3], [-4, 35]][[2, 1], [0, 1], [0, 1], [0, 1]]Failed
explicit oracle 2[[-1, 1], [0, 1], [0, 1]][[-1, 1], [0, 1], [1, 15]]Failed
explicit oracle 3[[-1, 1], [0, 1], [1, 15]][[-1, 1], [0, 1], [2, 15]]Failed
explicit oracle 4[[-1, 1], [0, 1], [2, 15]][[-1, 1], [0, 1], [1, 5]]Failed
explicit oracle 5[[-1, 1], [1, 2], [-1, 5]][[-1, 1], [1, 2], [-1, 6]]Failed
explicit oracle 6[[-1, 1], [1, 2], [-2, 15]][[-1, 1], [1, 2], [-1, 10]]Failed
explicit oracle 7[[-1, 1], [1, 2], [-1, 15]][[-1, 1], [1, 2], [-1, 30]]Failed

SHA-256 / ef3eea49da9211b77d3e320c8487808bd73f093c4903432ec53beb5ceaa74a06

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    nodes,values=x
    c=list(map(Fraction,values));n=len(c)
    for order in range(1,n):
     for i in range(n-1,order,-1):
      den=nodes[i]-nodes[i-order]
      if den==0:return None
      c[i]=(c[i]-c[i-1])/den
    return [[v.numerator,v.denominator] for v in c]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[-2, 0, 3], [-1, -1, 0]], [[-1, 1], [0, 1], [1, 15]]), ([[-2, 0, 3], [-1, -1, 1]], [[-1, 1], [0, 1], [2, 15]]), ([[-2, 0, 3], [-1, -1, 2]], [[-1, 1], [0, 1], [1, 5]]), ([[-2, 0, 3], [-1, 0, -1]], [[-1, 1], [1, 2], [-1, 6]]), ([[-2, 0, 3], [-1, 0, 0]], [[-1, 1], [1, 2], [-1, 10]]), ([[-2, 0, 3], [-1, 0, 1]], [[-1, 1], [1, 2], [-1, 30]])], [([[-2, 0, 3], [-1, -1, 0]], [[-1, 1], [0, 1], [1, 15]]), ([[-2, 0, 3], [-1, -1, 2]], [[-1, 1], [0, 1], [1, 5]]), ([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[-2, 0, 3], [0, -1, 0]], [[0, 1], [-1, 2], [1, 6]]), ([[-2, 0, 3], [0, -1, 1]], [[0, 1], [-1, 2], [7, 30]]), ([[-2, 0, 3], [0, -1, 2]], [[0, 1], [-1, 2], [3, 10]]), ([[-2, 0, 3], [0, 0, -1]], [[0, 1], [0, 1], [-1, 15]])], [([[-2, 0, 3], [-1, -1, 1]], [[-1, 1], [0, 1], [2, 15]]), ([[-2, 0, 3], [-1, 0, 1]], [[-1, 1], [1, 2], [-1, 30]]), ([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[-2, 0, 3], [1, -1, 1]], [[1, 1], [-1, 1], [1, 3]]), ([[-2, 0, 3], [1, -1, 2]], [[1, 1], [-1, 1], [2, 5]]), ([[-2, 0, 3], [1, 0, -1]], [[1, 1], [-1, 2], [1, 30]]), ([[-2, 0, 3], [1, 0, 0]], [[1, 1], [-1, 2], [1, 10]])], [([[-2, 0, 3], [-1, -1, 2]], [[-1, 1], [0, 1], [1, 5]]), ([[-2, 0, 3], [-1, 1, 0]], [[-1, 1], [1, 1], [-4, 15]]), ([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[-2, 0, 3], [2, -1, 2]], [[2, 1], [-3, 2], [1, 2]]), ([[-2, 0, 3], [2, 0, -1]], [[2, 1], [-1, 1], [2, 15]]), ([[-2, 0, 3], [2, 0, 0]], [[2, 1], [-1, 1], [1, 5]]), ([[-2, 0, 3], [2, 0, 1]], [[2, 1], [-1, 1], [4, 15]])], [([[-2, 0, 3], [-1, 0, -1]], [[-1, 1], [1, 2], [-1, 6]]), ([[-2, 0, 3], [-1, 2, -1]], [[-1, 1], [3, 2], [-1, 2]]), ([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[0, 1, 2], [-1, 0, -1]], [[-1, 1], [1, 1], [-1, 1]]), ([[0, 1, 2], [-1, 0, 0]], [[-1, 1], [1, 1], [-1, 2]]), ([[0, 1, 2], [-1, 0, 1]], [[-1, 1], [1, 1], [0, 1]]), ([[0, 1, 2], [-1, 0, 2]], [[-1, 1], [1, 1], [1, 2]])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, solve(args), expected)
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
explicit oracle 0[[-1, 1], [-1, 1], [0, 1]][[-1, 1], [0, 1], [0, 1]]Failed
explicit oracle 1[[2, 1], [2, 1], [0, 1], [0, 1]][[2, 1], [0, 1], [0, 1], [0, 1]]Failed
explicit oracle 2[[-1, 1], [-1, 1], [1, 3]][[-1, 1], [0, 1], [1, 15]]Failed
explicit oracle 3[[-1, 1], [-1, 1], [2, 3]][[-1, 1], [0, 1], [2, 15]]Failed
explicit oracle 4[[-1, 1], [-1, 1], [1, 1]][[-1, 1], [0, 1], [1, 5]]Failed
explicit oracle 5[[-1, 1], [0, 1], [-1, 3]][[-1, 1], [1, 2], [-1, 6]]Failed
explicit oracle 6[[-1, 1], [0, 1], [0, 1]][[-1, 1], [1, 2], [-1, 10]]Failed
explicit oracle 7[[-1, 1], [0, 1], [1, 3]][[-1, 1], [1, 2], [-1, 30]]Failed

SHA-256 / 568bc9812bce557259ec059219f192c14374a84e095fac120662c49b6aa198b4

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    nodes,values=x
    c=list(map(Fraction,values));n=len(c)
    for order in range(1,n):
     for i in range(n-1,order-1,-1):
      den=nodes[i]-nodes[i-order]
      if den==0:return None
      c[i]=(c[i]-c[i-1])/den
    return [[v.numerator,v.denominator] for v in c]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[-2, 0, 3], [-1, -1, 0]], [[-1, 1], [0, 1], [1, 15]]), ([[-2, 0, 3], [-1, -1, 1]], [[-1, 1], [0, 1], [2, 15]]), ([[-2, 0, 3], [-1, -1, 2]], [[-1, 1], [0, 1], [1, 5]]), ([[-2, 0, 3], [-1, 0, -1]], [[-1, 1], [1, 2], [-1, 6]]), ([[-2, 0, 3], [-1, 0, 0]], [[-1, 1], [1, 2], [-1, 10]]), ([[-2, 0, 3], [-1, 0, 1]], [[-1, 1], [1, 2], [-1, 30]])], [([[-2, 0, 3], [-1, -1, 0]], [[-1, 1], [0, 1], [1, 15]]), ([[-2, 0, 3], [-1, -1, 2]], [[-1, 1], [0, 1], [1, 5]]), ([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[-2, 0, 3], [0, -1, 0]], [[0, 1], [-1, 2], [1, 6]]), ([[-2, 0, 3], [0, -1, 1]], [[0, 1], [-1, 2], [7, 30]]), ([[-2, 0, 3], [0, -1, 2]], [[0, 1], [-1, 2], [3, 10]]), ([[-2, 0, 3], [0, 0, -1]], [[0, 1], [0, 1], [-1, 15]])], [([[-2, 0, 3], [-1, -1, 1]], [[-1, 1], [0, 1], [2, 15]]), ([[-2, 0, 3], [-1, 0, 1]], [[-1, 1], [1, 2], [-1, 30]]), ([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[-2, 0, 3], [1, -1, 1]], [[1, 1], [-1, 1], [1, 3]]), ([[-2, 0, 3], [1, -1, 2]], [[1, 1], [-1, 1], [2, 5]]), ([[-2, 0, 3], [1, 0, -1]], [[1, 1], [-1, 2], [1, 30]]), ([[-2, 0, 3], [1, 0, 0]], [[1, 1], [-1, 2], [1, 10]])], [([[-2, 0, 3], [-1, -1, 2]], [[-1, 1], [0, 1], [1, 5]]), ([[-2, 0, 3], [-1, 1, 0]], [[-1, 1], [1, 1], [-4, 15]]), ([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[-2, 0, 3], [2, -1, 2]], [[2, 1], [-3, 2], [1, 2]]), ([[-2, 0, 3], [2, 0, -1]], [[2, 1], [-1, 1], [2, 15]]), ([[-2, 0, 3], [2, 0, 0]], [[2, 1], [-1, 1], [1, 5]]), ([[-2, 0, 3], [2, 0, 1]], [[2, 1], [-1, 1], [4, 15]])], [([[-2, 0, 3], [-1, 0, -1]], [[-1, 1], [1, 2], [-1, 6]]), ([[-2, 0, 3], [-1, 2, -1]], [[-1, 1], [3, 2], [-1, 2]]), ([[-2, 0, 3], [-1, -1, -1]], [[-1, 1], [0, 1], [0, 1]]), ([[0, 2, 3, 7], [2, 2, 2, 2]], [[2, 1], [0, 1], [0, 1], [0, 1]]), ([[0, 1, 2], [-1, 0, -1]], [[-1, 1], [1, 1], [-1, 1]]), ([[0, 1, 2], [-1, 0, 0]], [[-1, 1], [1, 1], [-1, 2]]), ([[0, 1, 2], [-1, 0, 1]], [[-1, 1], [1, 1], [0, 1]]), ([[0, 1, 2], [-1, 0, 2]], [[-1, 1], [1, 1], [1, 2]])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, solve(args), expected)
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
explicit oracle 0[[-1, 1], [0, 1], [0, 1]][[-1, 1], [0, 1], [0, 1]]Passed
explicit oracle 1[[2, 1], [0, 1], [0, 1], [0, 1]][[2, 1], [0, 1], [0, 1], [0, 1]]Passed
explicit oracle 2[[-1, 1], [0, 1], [1, 15]][[-1, 1], [0, 1], [1, 15]]Passed
explicit oracle 3[[-1, 1], [0, 1], [2, 15]][[-1, 1], [0, 1], [2, 15]]Passed
explicit oracle 4[[-1, 1], [0, 1], [1, 5]][[-1, 1], [0, 1], [1, 5]]Passed
explicit oracle 5[[-1, 1], [1, 2], [-1, 6]][[-1, 1], [1, 2], [-1, 6]]Passed
explicit oracle 6[[-1, 1], [1, 2], [-1, 10]][[-1, 1], [1, 2], [-1, 10]]Passed
explicit oracle 7[[-1, 1], [1, 2], [-1, 30]][[-1, 1], [1, 2], [-1, 30]]Passed

SHA-256 / 4c44ff36dec76205cf3a336276b7c07728c954056ef3c2f6899b0ce56af84c63

Verification & scope

A deterministic bounded teaching model. Inputs are restricted to the explicit contract; this is not a production algebra library. 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:39:19.340746+00:00.

Case digest / 9e08d8754f63b1330e803e39d9e65619272e2a6508b0798c226007dba48b6372