Case 941
The wall was built to the average of the worst days
the_wall_was_built_to_the_average_of_the_worst_days.eml - A flood wall is built to the average of the ten highest annual water levels on record, the ten readings are real and the average is exact, and the wall is overtopped three years in ten. What an average of maxima is, is computed below.
ok: true — round-trip fixpoint reached (python1 == python2)updated 2026-09-20
EML
eml# Self-authored for the EML case corpus (no external origin). A flood wall is
# built to the average of the ten highest annual water levels on record, the
# ten readings are real and the average is exact, and the wall is overtopped
# three years in ten. What an average of maxima is, is computed below.
#
# The design is careful. It uses the real annual-maximum readings, not a guess;
# it uses only the worst day of each year, so ordinary days do not dilute it;
# the average is exact; and the intent is exactly 'a wall the worst days do
# not overtop'.
#
# An average of the worst days is a level about half of the worst days exceed,
# so a wall built to it is a wall built to be overtopped in a typical year, by
# design of the arithmetic.
31 => annual_max_year_1_decimetres
34 => annual_max_year_2_decimetres
29 => annual_max_year_3_decimetres
48 => annual_max_year_4_decimetres
30 => annual_max_year_5_decimetres
33 => annual_max_year_6_decimetres
36 => annual_max_year_7_decimetres
28 => annual_max_year_8_decimetres
52 => annual_max_year_9_decimetres
39 => annual_max_year_10_decimetres
10 => years_of_record
3 => years_whose_maximum_exceeds_the_average
52 => highest_on_record_decimetres
annual_max_year_1_decimetres + annual_max_year_2_decimetres + annual_max_year_3_decimetres + annual_max_year_4_decimetres + annual_max_year_5_decimetres + annual_max_year_6_decimetres + annual_max_year_7_decimetres + annual_max_year_8_decimetres + annual_max_year_9_decimetres + annual_max_year_10_decimetres => sum_of_annual_maxima
int(sum_of_annual_maxima / years_of_record) => wall_height_decimetres
int(years_whose_maximum_exceeds_the_average * 10000 / years_of_record) => years_overtopped_per_myriad
highest_on_record_decimetres - wall_height_decimetres => decimetres_the_record_year_overtops_by
"annual maxima on record (dm) : " + str(annual_max_year_1_decimetres) + " " + str(annual_max_year_2_decimetres) + " " + str(annual_max_year_3_decimetres) + " " + str(annual_max_year_4_decimetres) + " " + str(annual_max_year_5_decimetres) + " " + str(annual_max_year_6_decimetres) + " " + str(annual_max_year_7_decimetres) + " " + str(annual_max_year_8_decimetres) + " " + str(annual_max_year_9_decimetres) + " " + str(annual_max_year_10_decimetres) ^0
"sum / years : " + str(sum_of_annual_maxima) + " / " + str(years_of_record) ^0
"wall height, the average : " + str(wall_height_decimetres) + " dm" ^0
"" ^0
"years whose worst day exceeds it : " + str(years_whose_maximum_exceeds_the_average) + " of " + str(years_of_record) + " (48, 52, 39)" ^0
"years overtopped : " + str(years_overtopped_per_myriad) + " per ten thousand" ^0
"the record year overtops by : " + str(decimetres_the_record_year_overtops_by) + " dm" ^0
"" ^0
# ---- what the design verified ----
"the wall design" ^0
" data : the real annual-maximum readings" ^0
" selection : only the worst day of each year" ^0
" average : exact, " + str(wall_height_decimetres) + " dm" ^0
" intent : a wall the worst days do not overtop" ^0
" readings misused : 0" ^0
" verdict : BUILT TO THE AVERAGE OF THE WORST DAYS" ^0
"" ^0
" using only the real worst day of each year is the part" ^0
" done right here, and it is why ordinary days played no" ^0
" part in the height" ^0
"" ^0
# ---- what an average of maxima is ----
"the middle of the worst" ^0
" the ten worst days : range from 28 to 52 dm" ^0
" their average : " + str(wall_height_decimetres) + " dm, in the middle of them" ^0
" what is above the middle : some of the worst days, by" ^0
" construction - here " + str(years_whose_maximum_exceeds_the_average) + " of " + str(years_of_record) ^0
" so the wall : is at a height the worst day beats about" ^0
" a third of the years" ^0
" what 'the worst days do not overtop' would need : the" ^0
" top of the distribution, not its centre" ^0
"" ^0
# ---- what the town got ----
"the wall in service" ^0
" overtopped : " + str(years_overtopped_per_myriad) + " per ten thousand of years" ^0
" worst overtopping on record : " + str(decimetres_the_record_year_overtops_by) + " dm" ^0
" is the average miscomputed : no" ^0
" is the average of the worst days a bad day's level : no;" ^0
" it is a typical worst day, and half of them are worse" ^0
" than typical" ^0
"" ^0
# ---- null control ----
# The same record used to set the wall at a chosen return level (the record
# high plus freeboard, or a fitted extreme-value quantile) instead of at the
# mean of the maxima.
3 => nc_years_overtopped_at_the_mean_of_maxima
0 => nc_years_overtopped_at_the_record_plus_freeboard
3 => nc_overtoppings_the_extreme_level_prevents
"null control - design to an extreme quantile, not the mean of extremes" ^0
" years overtopped, wall at the mean of maxima : " + str(nc_years_overtopped_at_the_mean_of_maxima) + " of " + str(years_of_record) ^0
" years overtopped, wall at the record plus freeboard : " + str(nc_years_overtopped_at_the_record_plus_freeboard) ^0
" overtoppings the extreme level prevents : " + str(nc_overtoppings_the_extreme_level_prevents) ^0
" no reading changed; the wall stopped being set at the" ^0
" centre of the thing it was meant to exceed" ^0
"" ^0
# ---- the rule ----
"what a wall at the average of annual maxima guarantees" ^0
" it stands above the typical worst day : exactly, real" ^0
" maxima, exact mean" ^0
" it stands above the worst days : not addressed; the mean" ^0
" of the maxima sits inside them, and " + str(years_whose_maximum_exceeds_the_average) + " of " + str(years_of_record) + " years" ^0
" overtopped it, the record by " + str(decimetres_the_record_year_overtops_by) + " dm" ^0
"" ^0
"an average is the centre of whatever it averages, and the centre of the worst" ^0
"days is a worst day that half the others beat; a design that wants to clear" ^0
"the extremes must be set above them, not among them" ^0
"" ^0
"The wall is set exactly at the mean of the real annual maxima, " + str(wall_height_decimetres) + " dm - the" ^0
"typical worst day. But a mean sits inside the values it averages, so " + str(years_whose_maximum_exceeds_the_average) + " of the" ^0
"" + str(years_of_record) + " worst days on record are above it, " + str(years_overtopped_per_myriad) + " per ten thousand of years overtopped, the" ^0
"record by " + str(decimetres_the_record_year_overtops_by) + " dm, until the wall is set at an extreme quantile instead of the centre." ^0Python (deterministic transpilation)
pythonannual_max_year_1_decimetres = 31
annual_max_year_2_decimetres = 34
annual_max_year_3_decimetres = 29
annual_max_year_4_decimetres = 48
annual_max_year_5_decimetres = 30
annual_max_year_6_decimetres = 33
annual_max_year_7_decimetres = 36
annual_max_year_8_decimetres = 28
annual_max_year_9_decimetres = 52
annual_max_year_10_decimetres = 39
years_of_record = 10
years_whose_maximum_exceeds_the_average = 3
highest_on_record_decimetres = 52
sum_of_annual_maxima = annual_max_year_1_decimetres + annual_max_year_2_decimetres + annual_max_year_3_decimetres + annual_max_year_4_decimetres + annual_max_year_5_decimetres + annual_max_year_6_decimetres + annual_max_year_7_decimetres + annual_max_year_8_decimetres + annual_max_year_9_decimetres + annual_max_year_10_decimetres
wall_height_decimetres = int(sum_of_annual_maxima / years_of_record)
years_overtopped_per_myriad = int(years_whose_maximum_exceeds_the_average * 10000 / years_of_record)
decimetres_the_record_year_overtops_by = highest_on_record_decimetres - wall_height_decimetres
print("annual maxima on record (dm) : " + str(annual_max_year_1_decimetres) + " " + str(annual_max_year_2_decimetres) + " " + str(annual_max_year_3_decimetres) + " " + str(annual_max_year_4_decimetres) + " " + str(annual_max_year_5_decimetres) + " " + str(annual_max_year_6_decimetres) + " " + str(annual_max_year_7_decimetres) + " " + str(annual_max_year_8_decimetres) + " " + str(annual_max_year_9_decimetres) + " " + str(annual_max_year_10_decimetres))
print("sum / years : " + str(sum_of_annual_maxima) + " / " + str(years_of_record))
print("wall height, the average : " + str(wall_height_decimetres) + " dm")
print("")
print("years whose worst day exceeds it : " + str(years_whose_maximum_exceeds_the_average) + " of " + str(years_of_record) + " (48, 52, 39)")
print("years overtopped : " + str(years_overtopped_per_myriad) + " per ten thousand")
print("the record year overtops by : " + str(decimetres_the_record_year_overtops_by) + " dm")
print("")
print("the wall design")
print(" data : the real annual-maximum readings")
print(" selection : only the worst day of each year")
print(" average : exact, " + str(wall_height_decimetres) + " dm")
print(" intent : a wall the worst days do not overtop")
print(" readings misused : 0")
print(" verdict : BUILT TO THE AVERAGE OF THE WORST DAYS")
print("")
print(" using only the real worst day of each year is the part")
print(" done right here, and it is why ordinary days played no")
print(" part in the height")
print("")
print("the middle of the worst")
print(" the ten worst days : range from 28 to 52 dm")
print(" their average : " + str(wall_height_decimetres) + " dm, in the middle of them")
print(" what is above the middle : some of the worst days, by")
print(" construction - here " + str(years_whose_maximum_exceeds_the_average) + " of " + str(years_of_record))
print(" so the wall : is at a height the worst day beats about")
print(" a third of the years")
print(" what 'the worst days do not overtop' would need : the")
print(" top of the distribution, not its centre")
print("")
print("the wall in service")
print(" overtopped : " + str(years_overtopped_per_myriad) + " per ten thousand of years")
print(" worst overtopping on record : " + str(decimetres_the_record_year_overtops_by) + " dm")
print(" is the average miscomputed : no")
print(" is the average of the worst days a bad day's level : no;")
print(" it is a typical worst day, and half of them are worse")
print(" than typical")
print("")
nc_years_overtopped_at_the_mean_of_maxima = 3
nc_years_overtopped_at_the_record_plus_freeboard = 0
nc_overtoppings_the_extreme_level_prevents = 3
print("null control - design to an extreme quantile, not the mean of extremes")
print(" years overtopped, wall at the mean of maxima : " + str(nc_years_overtopped_at_the_mean_of_maxima) + " of " + str(years_of_record))
print(" years overtopped, wall at the record plus freeboard : " + str(nc_years_overtopped_at_the_record_plus_freeboard))
print(" overtoppings the extreme level prevents : " + str(nc_overtoppings_the_extreme_level_prevents))
print(" no reading changed; the wall stopped being set at the")
print(" centre of the thing it was meant to exceed")
print("")
print("what a wall at the average of annual maxima guarantees")
print(" it stands above the typical worst day : exactly, real")
print(" maxima, exact mean")
print(" it stands above the worst days : not addressed; the mean")
print(" of the maxima sits inside them, and " + str(years_whose_maximum_exceeds_the_average) + " of " + str(years_of_record) + " years")
print(" overtopped it, the record by " + str(decimetres_the_record_year_overtops_by) + " dm")
print("")
print("an average is the centre of whatever it averages, and the centre of the worst")
print("days is a worst day that half the others beat; a design that wants to clear")
print("the extremes must be set above them, not among them")
print("")
print("The wall is set exactly at the mean of the real annual maxima, " + str(wall_height_decimetres) + " dm - the")
print("typical worst day. But a mean sits inside the values it averages, so " + str(years_whose_maximum_exceeds_the_average) + " of the")
print("" + str(years_of_record) + " worst days on record are above it, " + str(years_overtopped_per_myriad) + " per ten thousand of years overtopped, the")
print("record by " + str(decimetres_the_record_year_overtops_by) + " dm, until the wall is set at an extreme quantile instead of the centre.")stdout (executed)
textannual maxima on record (dm) : 31 34 29 48 30 33 36 28 52 39
sum / years : 360 / 10
wall height, the average : 36 dm
years whose worst day exceeds it : 3 of 10 (48, 52, 39)
years overtopped : 3000 per ten thousand
the record year overtops by : 16 dm
the wall design
data : the real annual-maximum readings
selection : only the worst day of each year
average : exact, 36 dm
intent : a wall the worst days do not overtop
readings misused : 0
verdict : BUILT TO THE AVERAGE OF THE WORST DAYS
using only the real worst day of each year is the part
done right here, and it is why ordinary days played no
part in the height
the middle of the worst
the ten worst days : range from 28 to 52 dm
their average : 36 dm, in the middle of them
what is above the middle : some of the worst days, by
construction - here 3 of 10
so the wall : is at a height the worst day beats about
a third of the years
what 'the worst days do not overtop' would need : the
top of the distribution, not its centre
the wall in service
overtopped : 3000 per ten thousand of years
worst overtopping on record : 16 dm
is the average miscomputed : no
is the average of the worst days a bad day's level : no;
it is a typical worst day, and half of them are worse
than typical
null control - design to an extreme quantile, not the mean of extremes
years overtopped, wall at the mean of maxima : 3 of 10
years overtopped, wall at the record plus freeboard : 0
overtoppings the extreme level prevents : 3
no reading changed; the wall stopped being set at the
centre of the thing it was meant to exceed
what a wall at the average of annual maxima guarantees
it stands above the typical worst day : exactly, real
maxima, exact mean
it stands above the worst days : not addressed; the mean
of the maxima sits inside them, and 3 of 10 years
overtopped it, the record by 16 dm
an average is the centre of whatever it averages, and the centre of the worst
days is a worst day that half the others beat; a design that wants to clear
the extremes must be set above them, not among them
The wall is set exactly at the mean of the real annual maxima, 36 dm - the
typical worst day. But a mean sits inside the values it averages, so 3 of the
10 worst days on record are above it, 3000 per ten thousand of years overtopped, the
record by 16 dm, until the wall is set at an extreme quantile instead of the centre.Trace event types
eml:run:starteml:assigneml:outputeml:run:done