FAILURE MAP
← Case archive

FA-68901 / Tide and marine navigation tables / Open access

Cosine curve time for height: Heights equal to a turning point are rejected · case 01

Asking when high water height is reached returns None.

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

ROOT CAUSE

The reachability test excludes the endpoints of the range.

THE FAILURE

The reachability test excludes the endpoints of the range.

Unsuccessful approach: Accepting h equal to the upper end only still rejects the low water height.

Case contract

Input [t1,h1,t2,h2,h] (hours, metres) for consecutive turning points with t2>t1 and h1!=h2. Height follows h1+(h2-h1)*(1-cos(pi*s/T))/2 with s elapsed and T=t2-t1. Return the time in whole minutes (rounded half up) when the height h is first reached on that half-cycle, or None when h lies outside the closed range of h1..h2.

Why this case matters

Tide tables and passage plans turn published predictions into go/no-go decisions about depth, clearance and timing.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    t1,h1,t2,h2,h=x
    lo,hi=min(h1,h2),max(h1,h2)
    if h<=lo or h>=hi: return None
    frac=(h-h1)/(h2-h1)
    T=t2-t1
    s=T*math.acos(1-2*frac)/math.pi
    return math.floor((t1+s)*60+0.5)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('cosine curve time for height [0, 0.6, 6.2, 4.4, 0.6]', [0, 0.6, 6.2, 4.4, 0.6], 0), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 1.0]', [0, 0.6, 6.2, 4.4, 1.0], 78), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 2.5]', [0, 0.6, 6.2, 4.4, 2.5], 186), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 3.9]', [0, 0.6, 6.2, 4.4, 3.9], 284), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 4.4]', [0, 0.6, 6.2, 4.4, 4.4], 372), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 4.5]', [0, 0.6, 6.2, 4.4, 4.5], None), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 5.1]', [3.5, 5.1, 9.75, 1.2, 5.1], 210)], [('cosine curve time for height [0, 0.6, 6.2, 4.4, 4.4]', [0, 0.6, 6.2, 4.4, 4.4], 372), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 1.2]', [3.5, 5.1, 9.75, 1.2, 1.2], 585), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 3.9]', [0, 0.6, 6.2, 4.4, 3.9], 284), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 4.5]', [0, 0.6, 6.2, 4.4, 4.5], None), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 5.1]', [3.5, 5.1, 9.75, 1.2, 5.1], 210), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 4.0]', [3.5, 5.1, 9.75, 1.2, 4.0], 344), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 3.15]', [3.5, 5.1, 9.75, 1.2, 3.15], 398)], [('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 5.1]', [3.5, 5.1, 9.75, 1.2, 5.1], 210), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 0.6]', [0, 0.6, 6.2, 4.4, 0.6], 0), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 4.0]', [3.5, 5.1, 9.75, 1.2, 4.0], 344), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 3.15]', [3.5, 5.1, 9.75, 1.2, 3.15], 398), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 1.3]', [3.5, 5.1, 9.75, 1.2, 1.3], 547), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 1.2]', [3.5, 5.1, 9.75, 1.2, 1.2], 585), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 0.9]', [3.5, 5.1, 9.75, 1.2, 0.9], None)], [('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 1.2]', [3.5, 5.1, 9.75, 1.2, 1.2], 585), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 1.3]', [3.5, 5.1, 9.75, 1.2, 1.3], 547), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 0.9]', [3.5, 5.1, 9.75, 1.2, 0.9], None), ('cosine curve time for height [10, 2.0, 22.4, 2.6, 2.3]', [10, 2.0, 22.4, 2.6, 2.3], 972), ('cosine curve time for height [0, 0, 2, 1, 0.25]', [0, 0, 2, 1, 0.25], 40), ('cosine curve time for height [1.25, 1.0, 7.25, 3.0, 2.0]', [1.25, 1.0, 7.25, 3.0, 2.0], 255), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 0.6]', [0, 0.6, 6.2, 4.4, 0.6], 0)], [('cosine curve time for height [0, 0.6, 6.2, 4.4, 0.6]', [0, 0.6, 6.2, 4.4, 0.6], 0), ('cosine curve time for height [10, 2.0, 22.4, 2.6, 2.3]', [10, 2.0, 22.4, 2.6, 2.3], 972), ('cosine curve time for height [0, 0, 2, 1, 0.25]', [0, 0, 2, 1, 0.25], 40), ('cosine curve time for height [1.25, 1.0, 7.25, 3.0, 2.0]', [1.25, 1.0, 7.25, 3.0, 2.0], 255), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 1.0]', [0, 0.6, 6.2, 4.4, 1.0], 78), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 2.5]', [0, 0.6, 6.2, 4.4, 2.5], 186), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 3.9]', [0, 0.6, 6.2, 4.4, 3.9], 284)]]
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
cosine curve time for height [0, 0.6, 6.2, 4.4, 0.6]None0Failed
cosine curve time for height [0, 0.6, 6.2, 4.4, 1.0]7878Passed
cosine curve time for height [0, 0.6, 6.2, 4.4, 2.5]186186Passed
cosine curve time for height [0, 0.6, 6.2, 4.4, 3.9]284284Passed
cosine curve time for height [0, 0.6, 6.2, 4.4, 4.4]None372Failed
cosine curve time for height [0, 0.6, 6.2, 4.4, 4.5]NoneNonePassed
cosine curve time for height [3.5, 5.1, 9.75, 1.2, 5.1]None210Failed

SHA-256 / d47d03f6e30d730862a0e3209e88268592254cf3a37eb0566a2b45af299c9089

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    t1,h1,t2,h2,h=x
    lo,hi=min(h1,h2),max(h1,h2)
    if h<=lo or h>hi: return None
    frac=(h-h1)/(h2-h1)
    T=t2-t1
    s=T*math.acos(1-2*frac)/math.pi
    return math.floor((t1+s)*60+0.5)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('cosine curve time for height [0, 0.6, 6.2, 4.4, 0.6]', [0, 0.6, 6.2, 4.4, 0.6], 0), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 1.0]', [0, 0.6, 6.2, 4.4, 1.0], 78), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 2.5]', [0, 0.6, 6.2, 4.4, 2.5], 186), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 3.9]', [0, 0.6, 6.2, 4.4, 3.9], 284), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 4.4]', [0, 0.6, 6.2, 4.4, 4.4], 372), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 4.5]', [0, 0.6, 6.2, 4.4, 4.5], None), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 5.1]', [3.5, 5.1, 9.75, 1.2, 5.1], 210)], [('cosine curve time for height [0, 0.6, 6.2, 4.4, 4.4]', [0, 0.6, 6.2, 4.4, 4.4], 372), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 1.2]', [3.5, 5.1, 9.75, 1.2, 1.2], 585), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 3.9]', [0, 0.6, 6.2, 4.4, 3.9], 284), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 4.5]', [0, 0.6, 6.2, 4.4, 4.5], None), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 5.1]', [3.5, 5.1, 9.75, 1.2, 5.1], 210), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 4.0]', [3.5, 5.1, 9.75, 1.2, 4.0], 344), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 3.15]', [3.5, 5.1, 9.75, 1.2, 3.15], 398)], [('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 5.1]', [3.5, 5.1, 9.75, 1.2, 5.1], 210), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 0.6]', [0, 0.6, 6.2, 4.4, 0.6], 0), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 4.0]', [3.5, 5.1, 9.75, 1.2, 4.0], 344), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 3.15]', [3.5, 5.1, 9.75, 1.2, 3.15], 398), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 1.3]', [3.5, 5.1, 9.75, 1.2, 1.3], 547), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 1.2]', [3.5, 5.1, 9.75, 1.2, 1.2], 585), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 0.9]', [3.5, 5.1, 9.75, 1.2, 0.9], None)], [('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 1.2]', [3.5, 5.1, 9.75, 1.2, 1.2], 585), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 1.3]', [3.5, 5.1, 9.75, 1.2, 1.3], 547), ('cosine curve time for height [3.5, 5.1, 9.75, 1.2, 0.9]', [3.5, 5.1, 9.75, 1.2, 0.9], None), ('cosine curve time for height [10, 2.0, 22.4, 2.6, 2.3]', [10, 2.0, 22.4, 2.6, 2.3], 972), ('cosine curve time for height [0, 0, 2, 1, 0.25]', [0, 0, 2, 1, 0.25], 40), ('cosine curve time for height [1.25, 1.0, 7.25, 3.0, 2.0]', [1.25, 1.0, 7.25, 3.0, 2.0], 255), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 0.6]', [0, 0.6, 6.2, 4.4, 0.6], 0)], [('cosine curve time for height [0, 0.6, 6.2, 4.4, 0.6]', [0, 0.6, 6.2, 4.4, 0.6], 0), ('cosine curve time for height [10, 2.0, 22.4, 2.6, 2.3]', [10, 2.0, 22.4, 2.6, 2.3], 972), ('cosine curve time for height [0, 0, 2, 1, 0.25]', [0, 0, 2, 1, 0.25], 40), ('cosine curve time for height [1.25, 1.0, 7.25, 3.0, 2.0]', [1.25, 1.0, 7.25, 3.0, 2.0], 255), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 1.0]', [0, 0.6, 6.2, 4.4, 1.0], 78), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 2.5]', [0, 0.6, 6.2, 4.4, 2.5], 186), ('cosine curve time for height [0, 0.6, 6.2, 4.4, 3.9]', [0, 0.6, 6.2, 4.4, 3.9], 284)]]
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
cosine curve time for height [0, 0.6, 6.2, 4.4, 0.6]None0Failed
cosine curve time for height [0, 0.6, 6.2, 4.4, 1.0]7878Passed
cosine curve time for height [0, 0.6, 6.2, 4.4, 2.5]186186Passed
cosine curve time for height [0, 0.6, 6.2, 4.4, 3.9]284284Passed
cosine curve time for height [0, 0.6, 6.2, 4.4, 4.4]372372Passed
cosine curve time for height [0, 0.6, 6.2, 4.4, 4.5]NoneNonePassed
cosine curve time for height [3.5, 5.1, 9.75, 1.2, 5.1]210210Passed

SHA-256 / 9e0256e6bfeba0598c68959b32fd5233adde357356486aa212449288e21055a0

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A deterministic toy model with stipulated rules and constants; not certified hydrographic software or a substitute for official tide tables. 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:48:06.472201+00:00.

Case digest / baa86cf08f774860c00222ce6d8bb403c77e1d3a9f49b3ac0f526e221b5d9761