FAILURE MAP
← Case archive

FA-91376 / Digital signal filters / Open access

Transposed DF-II updates s2 before s1 consumes it · case 01

The impulse response loses its two-sample memory: s1 uses the freshly computed s2 from the same sample.

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

ROOT CAUSE

The s2 update is executed before the s1 update, so s1 adds the new rather than the previous s2.

VERIFIED REPAIR

Update s1 from the previous s2 first, then overwrite s2.

Unsuccessful approach: The attempted repair drops s2 from the s1 update altogether, turning the section into first order.

Case contract

Input [[b0, b1, b2, a1, a2], samples, prime] (a0 = 1). Transposed direct form II: y = b0 x + s1; s1 = b1 x - a1 y + s2; s2 = b2 x - a2 y. If prime and samples exist, initialize s1, s2 to the steady state for a constant input equal to the first sample (y_ss = x0 (b0+b1+b2)/(1+a1+a2), "dc-pole" if the denominator is 0). Return exact fraction strings.

Why this case matters

Transposed DF-II is the default numerical form in filtering libraries, and steady-state priming avoids start-up transients.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
    b0, b1, b2, a1, a2 = [Fraction(v) for v in x[0]]
    xs, prime = x[1], x[2]
    s1 = s2 = Fraction(0)
    if prime and xs:
        den = 1 + a1 + a2
        if den == 0:
            return 'dc-pole'
        x0 = xs[0]
        yss = x0 * (b0 + b1 + b2) / den
        s1 = yss - b0 * x0
        s2 = b2 * x0 - a2 * yss
    out = []
    for v in xs:
        y = b0 * v + s1
        s2 = b2 * v - a2 * y
        s1 = b1 * v - a1 * y + s2
        out.append(str(y))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: unprimed impulse', [['1', '1/2', '1/3', '1/2', '-1/4'], [1, 0, 0, 0], False], ['1', '0', '7/12', '-7/24']], ['regression: random df2t 0', [['5/4', '1/3', '3/4', '-1/2', '2'], [-1, 2, 4, 4, 1], False], ['-5/4', '37/24', '131/16', '283/32', '-1223/192']], ['repair check: primed step lowpass', [['1/4', '1/2', '1/4', '-1/2', '1/4'], [2, 2, 2, 2], True], ['8/3', '8/3', '8/3', '8/3']], ['control: dc pole', [['1', '0', '0', '-2', '1'], [1, 1], True], 'dc-pole'], ['control: primed empty', [['1', '0', '0', '0', '0'], [], True], []], ['control: random df2t 3', [['1/8', '3/4', '-3/8', '-1/2', '1/8'], [2], False], ['1/4']], ['control: random df2t 4', [['-1/2', '-3/8', '0', '0', '1/3'], [-3], True], ['63/32']]], [['regression: random df2t 6', [['0', '-1/2', '1/8', '3/4', '3/4'], [4, 4, 2, 4], False], ['0', '-2', '0', '1']], ['regression: random df2t 7', [['-1/2', '2', '-1/4', '1/2', '2'], [3, 2, -2, 0], True], ['15/14', '11/7', '37/28', '-465/56']], ['regression: unprimed impulse', [['1', '1/2', '1/3', '1/2', '-1/4'], [1, 0, 0, 0], False], ['1', '0', '7/12', '-7/24']], ['control: random df2t 5', [['-3/8', '-1/4', '-1/4', '1/3', '-1/4'], [2], True], ['-21/13']], ['control: random df2t 11', [['1/8', '1/8', '5/4', '-3/8', '1/2'], [0], True], ['0']], ['control: random df2t 12', [['-1/2', '5/4', '-1/4', '5/4', '-1/4'], [0, 0], False], ['0', '0']], ['control: random df2t 14', [['1/3', '2', '1/2', '1/2', '5/4'], [0, -2], True], ['0', '-2/3']]], [['regression: random df2t 9', [['-3/8', '0', '-1/2', '2', '5/4'], [3, -3, 3, 2], False], ['-9/8', '27/8', '-255/32', '399/32']], ['regression: random df2t 10', [['1/8', '1/3', '-1/4', '1/3', '1/8'], [1, -1, 2, 3, 3], False], ['1/8', '1/6', '-233/576', '2429/1728', '18953/41472']], ['regression: random df2t 1', [['-1/4', '-1/2', '0', '-1/2', '-3/8'], [-3, 3, 1, 2], False], ['3/4', '9/8', '-29/32', '-33/32']], ['control: random df2t 15', [['-1/4', '2', '-1/2', '1/2', '1/2'], [4], False], ['-1']], ['control: random df2t 20', [['5/4', '0', '5/4', '-1/2', '-1/2'], [-3, 1], True], 'dc-pole'], ['control: random df2t 22', [['1/3', '-3/8', '1/3', '0', '5/4'], [4], True], ['14/27']], ['control: random df2t 31', [['-1/2', '1/8', '1/2', '-1/2', '-1/4'], [0, -3], False], ['0', '3/2']]], [['regression: random df2t 16', [['5/4', '1/8', '1/8', '-3/8', '1/3'], [-2, 2, 3], True], ['-72/23', '43/23', '1011/184']], ['regression: random df2t 18', [['0', '-3/8', '1/3', '1/3', '2'], [4, 4, 2, 0, -3], True], ['-1/20', '-1/20', '-1/20', '7/10', '8/15']], ['regression: random df2t 6', [['0', '-1/2', '1/8', '3/4', '3/4'], [4, 4, 2, 4], False], ['0', '-2', '0', '1']], ['control: random df2t 35', [['2', '1/8', '1/8', '-1/2', '-1/2'], [2, -3, 1], True], 'dc-pole'], ['control: random df2t 43', [['1/3', '3/4', '5/4', '1/3', '3/4'], [2], False], ['2/3']], ['control: random df2t 48', [['-1/4', '1/2', '-1/2', '-3/8', '-1/2'], [-1], False], ['1/4']], ['control: random df2t 49', [['0', '2', '0', '-1/2', '2'], [0], True], ['0']]], [['regression: random df2t 21', [['1/2', '1/8', '-1/4', '-1/4', '3/4'], [2, 0, 3, -3], False], ['1', '1/2', '3/8', '-45/32']], ['regression: random df2t 23', [['3/4', '0', '-1/2', '-1/2', '0'], [3, 0, 3], False], ['9/4', '9/8', '21/16']], ['regression: random df2t 8', [['-3/8', '2', '1/8', '1/3', '2'], [4, -3, -2, 1, 4], True], ['21/10', '189/40', '-421/40', '-1283/120', '8951/360']], ['control: dc pole', [['1', '0', '0', '-2', '1'], [1, 1], True], 'dc-pole'], ['control: primed empty', [['1', '0', '0', '0', '0'], [], True], []], ['control: random df2t 3', [['1/8', '3/4', '-3/8', '-1/2', '1/8'], [2], False], ['1/4']], ['control: random df2t 4', [['-1/2', '-3/8', '0', '0', '1/3'], [-3], True], ['63/32']]]]
for label, args, expected in fixtures[N-1]:
    check(label, 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
regression: unprimed impulse['1', '7/12', '-7/48', '7/192']['1', '0', '7/12', '-7/24']Failed
regression: random df2t 0['-5/4', '79/24', '107/48', '575/96', '-653/192']['-5/4', '37/24', '131/16', '283/32', '-1223/192']Failed
repair check: primed step lowpass['8/3', '8/3', '8/3', '8/3']['8/3', '8/3', '8/3', '8/3']Passed
control: dc poledc-poledc-polePassed
control: primed empty[][]Passed
control: random df2t 3['1/4']['1/4']Passed
control: random df2t 4['63/32']['63/32']Passed

SHA-256 / cf36836fa51a3bb4a35b23004c233ce7822d58ed7c98d9c0920a99af039d3f14

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
    b0, b1, b2, a1, a2 = [Fraction(v) for v in x[0]]
    xs, prime = x[1], x[2]
    s1 = s2 = Fraction(0)
    if prime and xs:
        den = 1 + a1 + a2
        if den == 0:
            return 'dc-pole'
        x0 = xs[0]
        yss = x0 * (b0 + b1 + b2) / den
        s1 = yss - b0 * x0
        s2 = b2 * x0 - a2 * yss
    out = []
    for v in xs:
        y = b0 * v + s1
        s1 = b1 * v - a1 * y
        s2 = b2 * v - a2 * y
        out.append(str(y))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: unprimed impulse', [['1', '1/2', '1/3', '1/2', '-1/4'], [1, 0, 0, 0], False], ['1', '0', '7/12', '-7/24']], ['regression: random df2t 0', [['5/4', '1/3', '3/4', '-1/2', '2'], [-1, 2, 4, 4, 1], False], ['-5/4', '37/24', '131/16', '283/32', '-1223/192']], ['repair check: primed step lowpass', [['1/4', '1/2', '1/4', '-1/2', '1/4'], [2, 2, 2, 2], True], ['8/3', '8/3', '8/3', '8/3']], ['control: dc pole', [['1', '0', '0', '-2', '1'], [1, 1], True], 'dc-pole'], ['control: primed empty', [['1', '0', '0', '0', '0'], [], True], []], ['control: random df2t 3', [['1/8', '3/4', '-3/8', '-1/2', '1/8'], [2], False], ['1/4']], ['control: random df2t 4', [['-1/2', '-3/8', '0', '0', '1/3'], [-3], True], ['63/32']]], [['regression: random df2t 6', [['0', '-1/2', '1/8', '3/4', '3/4'], [4, 4, 2, 4], False], ['0', '-2', '0', '1']], ['regression: random df2t 7', [['-1/2', '2', '-1/4', '1/2', '2'], [3, 2, -2, 0], True], ['15/14', '11/7', '37/28', '-465/56']], ['regression: unprimed impulse', [['1', '1/2', '1/3', '1/2', '-1/4'], [1, 0, 0, 0], False], ['1', '0', '7/12', '-7/24']], ['control: random df2t 5', [['-3/8', '-1/4', '-1/4', '1/3', '-1/4'], [2], True], ['-21/13']], ['control: random df2t 11', [['1/8', '1/8', '5/4', '-3/8', '1/2'], [0], True], ['0']], ['control: random df2t 12', [['-1/2', '5/4', '-1/4', '5/4', '-1/4'], [0, 0], False], ['0', '0']], ['control: random df2t 14', [['1/3', '2', '1/2', '1/2', '5/4'], [0, -2], True], ['0', '-2/3']]], [['regression: random df2t 9', [['-3/8', '0', '-1/2', '2', '5/4'], [3, -3, 3, 2], False], ['-9/8', '27/8', '-255/32', '399/32']], ['regression: random df2t 10', [['1/8', '1/3', '-1/4', '1/3', '1/8'], [1, -1, 2, 3, 3], False], ['1/8', '1/6', '-233/576', '2429/1728', '18953/41472']], ['regression: random df2t 1', [['-1/4', '-1/2', '0', '-1/2', '-3/8'], [-3, 3, 1, 2], False], ['3/4', '9/8', '-29/32', '-33/32']], ['control: random df2t 15', [['-1/4', '2', '-1/2', '1/2', '1/2'], [4], False], ['-1']], ['control: random df2t 20', [['5/4', '0', '5/4', '-1/2', '-1/2'], [-3, 1], True], 'dc-pole'], ['control: random df2t 22', [['1/3', '-3/8', '1/3', '0', '5/4'], [4], True], ['14/27']], ['control: random df2t 31', [['-1/2', '1/8', '1/2', '-1/2', '-1/4'], [0, -3], False], ['0', '3/2']]], [['regression: random df2t 16', [['5/4', '1/8', '1/8', '-3/8', '1/3'], [-2, 2, 3], True], ['-72/23', '43/23', '1011/184']], ['regression: random df2t 18', [['0', '-3/8', '1/3', '1/3', '2'], [4, 4, 2, 0, -3], True], ['-1/20', '-1/20', '-1/20', '7/10', '8/15']], ['regression: random df2t 6', [['0', '-1/2', '1/8', '3/4', '3/4'], [4, 4, 2, 4], False], ['0', '-2', '0', '1']], ['control: random df2t 35', [['2', '1/8', '1/8', '-1/2', '-1/2'], [2, -3, 1], True], 'dc-pole'], ['control: random df2t 43', [['1/3', '3/4', '5/4', '1/3', '3/4'], [2], False], ['2/3']], ['control: random df2t 48', [['-1/4', '1/2', '-1/2', '-3/8', '-1/2'], [-1], False], ['1/4']], ['control: random df2t 49', [['0', '2', '0', '-1/2', '2'], [0], True], ['0']]], [['regression: random df2t 21', [['1/2', '1/8', '-1/4', '-1/4', '3/4'], [2, 0, 3, -3], False], ['1', '1/2', '3/8', '-45/32']], ['regression: random df2t 23', [['3/4', '0', '-1/2', '-1/2', '0'], [3, 0, 3], False], ['9/4', '9/8', '21/16']], ['regression: random df2t 8', [['-3/8', '2', '1/8', '1/3', '2'], [4, -3, -2, 1, 4], True], ['21/10', '189/40', '-421/40', '-1283/120', '8951/360']], ['control: dc pole', [['1', '0', '0', '-2', '1'], [1, 1], True], 'dc-pole'], ['control: primed empty', [['1', '0', '0', '0', '0'], [], True], []], ['control: random df2t 3', [['1/8', '3/4', '-3/8', '-1/2', '1/8'], [2], False], ['1/4']], ['control: random df2t 4', [['-1/2', '-3/8', '0', '0', '1/3'], [-3], True], ['63/32']]]]
for label, args, expected in fixtures[N-1]:
    check(label, 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
regression: unprimed impulse['1', '0', '0', '0']['1', '0', '7/12', '-7/24']Failed
regression: random df2t 0['-5/4', '37/24', '103/16', '917/96', '471/64']['-5/4', '37/24', '131/16', '283/32', '-1223/192']Failed
repair check: primed step lowpass['8/3', '17/6', '35/12', '71/24']['8/3', '8/3', '8/3', '8/3']Failed
control: dc poledc-poledc-polePassed
control: primed empty[][]Passed
control: random df2t 3['1/4']['1/4']Passed
control: random df2t 4['63/32']['63/32']Passed

SHA-256 / f68566bbc6e149ae465333d4ba5d78c7480c2035aac235df46b58415639672a2

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
    b0, b1, b2, a1, a2 = [Fraction(v) for v in x[0]]
    xs, prime = x[1], x[2]
    s1 = s2 = Fraction(0)
    if prime and xs:
        den = 1 + a1 + a2
        if den == 0:
            return 'dc-pole'
        x0 = xs[0]
        yss = x0 * (b0 + b1 + b2) / den
        s1 = yss - b0 * x0
        s2 = b2 * x0 - a2 * yss
    out = []
    for v in xs:
        y = b0 * v + s1
        s1 = b1 * v - a1 * y + s2
        s2 = b2 * v - a2 * y
        out.append(str(y))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: unprimed impulse', [['1', '1/2', '1/3', '1/2', '-1/4'], [1, 0, 0, 0], False], ['1', '0', '7/12', '-7/24']], ['regression: random df2t 0', [['5/4', '1/3', '3/4', '-1/2', '2'], [-1, 2, 4, 4, 1], False], ['-5/4', '37/24', '131/16', '283/32', '-1223/192']], ['repair check: primed step lowpass', [['1/4', '1/2', '1/4', '-1/2', '1/4'], [2, 2, 2, 2], True], ['8/3', '8/3', '8/3', '8/3']], ['control: dc pole', [['1', '0', '0', '-2', '1'], [1, 1], True], 'dc-pole'], ['control: primed empty', [['1', '0', '0', '0', '0'], [], True], []], ['control: random df2t 3', [['1/8', '3/4', '-3/8', '-1/2', '1/8'], [2], False], ['1/4']], ['control: random df2t 4', [['-1/2', '-3/8', '0', '0', '1/3'], [-3], True], ['63/32']]], [['regression: random df2t 6', [['0', '-1/2', '1/8', '3/4', '3/4'], [4, 4, 2, 4], False], ['0', '-2', '0', '1']], ['regression: random df2t 7', [['-1/2', '2', '-1/4', '1/2', '2'], [3, 2, -2, 0], True], ['15/14', '11/7', '37/28', '-465/56']], ['regression: unprimed impulse', [['1', '1/2', '1/3', '1/2', '-1/4'], [1, 0, 0, 0], False], ['1', '0', '7/12', '-7/24']], ['control: random df2t 5', [['-3/8', '-1/4', '-1/4', '1/3', '-1/4'], [2], True], ['-21/13']], ['control: random df2t 11', [['1/8', '1/8', '5/4', '-3/8', '1/2'], [0], True], ['0']], ['control: random df2t 12', [['-1/2', '5/4', '-1/4', '5/4', '-1/4'], [0, 0], False], ['0', '0']], ['control: random df2t 14', [['1/3', '2', '1/2', '1/2', '5/4'], [0, -2], True], ['0', '-2/3']]], [['regression: random df2t 9', [['-3/8', '0', '-1/2', '2', '5/4'], [3, -3, 3, 2], False], ['-9/8', '27/8', '-255/32', '399/32']], ['regression: random df2t 10', [['1/8', '1/3', '-1/4', '1/3', '1/8'], [1, -1, 2, 3, 3], False], ['1/8', '1/6', '-233/576', '2429/1728', '18953/41472']], ['regression: random df2t 1', [['-1/4', '-1/2', '0', '-1/2', '-3/8'], [-3, 3, 1, 2], False], ['3/4', '9/8', '-29/32', '-33/32']], ['control: random df2t 15', [['-1/4', '2', '-1/2', '1/2', '1/2'], [4], False], ['-1']], ['control: random df2t 20', [['5/4', '0', '5/4', '-1/2', '-1/2'], [-3, 1], True], 'dc-pole'], ['control: random df2t 22', [['1/3', '-3/8', '1/3', '0', '5/4'], [4], True], ['14/27']], ['control: random df2t 31', [['-1/2', '1/8', '1/2', '-1/2', '-1/4'], [0, -3], False], ['0', '3/2']]], [['regression: random df2t 16', [['5/4', '1/8', '1/8', '-3/8', '1/3'], [-2, 2, 3], True], ['-72/23', '43/23', '1011/184']], ['regression: random df2t 18', [['0', '-3/8', '1/3', '1/3', '2'], [4, 4, 2, 0, -3], True], ['-1/20', '-1/20', '-1/20', '7/10', '8/15']], ['regression: random df2t 6', [['0', '-1/2', '1/8', '3/4', '3/4'], [4, 4, 2, 4], False], ['0', '-2', '0', '1']], ['control: random df2t 35', [['2', '1/8', '1/8', '-1/2', '-1/2'], [2, -3, 1], True], 'dc-pole'], ['control: random df2t 43', [['1/3', '3/4', '5/4', '1/3', '3/4'], [2], False], ['2/3']], ['control: random df2t 48', [['-1/4', '1/2', '-1/2', '-3/8', '-1/2'], [-1], False], ['1/4']], ['control: random df2t 49', [['0', '2', '0', '-1/2', '2'], [0], True], ['0']]], [['regression: random df2t 21', [['1/2', '1/8', '-1/4', '-1/4', '3/4'], [2, 0, 3, -3], False], ['1', '1/2', '3/8', '-45/32']], ['regression: random df2t 23', [['3/4', '0', '-1/2', '-1/2', '0'], [3, 0, 3], False], ['9/4', '9/8', '21/16']], ['regression: random df2t 8', [['-3/8', '2', '1/8', '1/3', '2'], [4, -3, -2, 1, 4], True], ['21/10', '189/40', '-421/40', '-1283/120', '8951/360']], ['control: dc pole', [['1', '0', '0', '-2', '1'], [1, 1], True], 'dc-pole'], ['control: primed empty', [['1', '0', '0', '0', '0'], [], True], []], ['control: random df2t 3', [['1/8', '3/4', '-3/8', '-1/2', '1/8'], [2], False], ['1/4']], ['control: random df2t 4', [['-1/2', '-3/8', '0', '0', '1/3'], [-3], True], ['63/32']]]]
for label, args, expected in fixtures[N-1]:
    check(label, 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
regression: unprimed impulse['1', '0', '7/12', '-7/24']['1', '0', '7/12', '-7/24']Passed
regression: random df2t 0['-5/4', '37/24', '131/16', '283/32', '-1223/192']['-5/4', '37/24', '131/16', '283/32', '-1223/192']Passed
repair check: primed step lowpass['8/3', '8/3', '8/3', '8/3']['8/3', '8/3', '8/3', '8/3']Passed
control: dc poledc-poledc-polePassed
control: primed empty[][]Passed
control: random df2t 3['1/4']['1/4']Passed
control: random df2t 4['63/32']['63/32']Passed

SHA-256 / 9de33c5bd3b3823743d646a5aa15f3ee66142c2d8dbfdd1a5bbfae621b7215b9

Verification & scope

A deterministic bounded teaching model with a stipulated toy contract; exact rational arithmetic or fixed-decimal rounding keeps outputs strict JSON. It is not a production DSP library and claims no standards conformance. 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:51:35.469312+00:00.

Case digest / e4d1c325fbe5c4e268b160af4eec4a9e2345291ade03721edf510a69950c2d95