Atelier des rouesLab FR
Objects/Documentation

pondere24.py

I recompute the depletion, survival and bit-cost examples.

Download ↓
"""Independent spot checks of the depletion, moment and coding examples."""
import json
from math import comb, exp, expm1, log, log1p, log2, prod, sqrt
from fractions import Fraction as F


def late_profile(n):
    # The elementary early prefix can have far more steps than a loop can visit.
    step = n ** -3
    count = round((-log(n) / 4) / log1p(-step))
    q0 = exp(count * log1p(-step))
    late = int(8 * sqrt(n))
    b = .5 / n
    weight = comb(n, 2) * q0 ** 2 * b ** 2 * expm1(2 * late * log1p(-b)) / expm1(2 * log1p(-b))
    return dict(N=n, q0=round(q0, 12), late_mass=round(weight, 12),
                canonical_late_affinity=round(exp(-weight / 2), 12))

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.