Objets/Documentation
histoires17.py
Je fournis le calcul direct des affinités.
Télécharger ↓"""Sum sqrt(PQ) over count histories. Only zero, one or two deaths can contribute."""
import json
from math import exp, expm1, log1p, sqrt, fsum
from intervalles17 import blocks, canonical, leading
def affinity(h, word, selection):
n = h*h
b = 1/(n*sqrt(h))
mass = [1.]
for rates in blocks(h,word,selection):
a = rates[0]*b
c = rates[1]*b if len(rates)==2 else 0.
log_u = log1p(-a)+log1p(-c)
hit = -expm1(log_u)
after = [0.] * min(n+1,len(mass)+len(rates))