FAILURE MAP
← Case archive

FA-6446 / Discrete calculus / Open access

Newton step quadratic root · case 01

The reciprocal correction is returned without averaging the current iterate.

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

ROOT CAUSE

The reciprocal correction is returned without averaging the current iterate.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return str((Fraction(x)+Fraction(target,x))/2)

Unsuccessful approach: The Newton average lacks its factor of one half.

Case contract

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. x>0 and target>=0; return one exact Newton step for x*x-target=0. Exact operational definition: str((Fraction(x)+Fraction(target,x))/2)

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, target):
    return str(Fraction(target,x))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 9)', solve(*(3, 9)), '3')
check('fixture 2: (2, 9)', solve(*(2, 9)), '13/4')
check('fixture 3: (1, 2)', solve(*(1, 2)), '3/2')
check('fixture 4: (4, 0)', solve(*(4, 0)), '2')
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: (3, 9)33Passed
fixture 2: (2, 9)9/213/4Failed
fixture 3: (1, 2)23/2Failed
fixture 4: (4, 0)02Failed

SHA-256 / f5eef8baed049e05cea348010ba0c8977b201dcad0fdc33772d7d0b63ed8523b

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, target):
    return str(Fraction(x)+Fraction(target,x))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 9)', solve(*(3, 9)), '3')
check('fixture 2: (2, 9)', solve(*(2, 9)), '13/4')
check('fixture 3: (1, 2)', solve(*(1, 2)), '3/2')
check('fixture 4: (4, 0)', solve(*(4, 0)), '2')
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: (3, 9)63Failed
fixture 2: (2, 9)13/213/4Failed
fixture 3: (1, 2)33/2Failed
fixture 4: (4, 0)42Failed

SHA-256 / 08681781785dfb2ec359fb5794763e3fa16b4fff552e56c3d51ae9fee425e4b5

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, target):
    return str((Fraction(x)+Fraction(target,x))/2)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 9)', solve(*(3, 9)), '3')
check('fixture 2: (2, 9)', solve(*(2, 9)), '13/4')
check('fixture 3: (1, 2)', solve(*(1, 2)), '3/2')
check('fixture 4: (4, 0)', solve(*(4, 0)), '2')
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: (3, 9)33Passed
fixture 2: (2, 9)13/413/4Passed
fixture 3: (1, 2)3/23/2Passed
fixture 4: (4, 0)22Passed

SHA-256 / d40ef3efc4c83cb6e0d7dc51047931d9222ab44ce79e2d3dca84a9ef46656b42

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

Case digest / 4e519d8d53a8f5cea080bbbee1f460ff5c9c59f2aef5491bc9d9a7470a81e483