"""An exact finite check accompanying Character coefficients for integrals of odd products of hyperbolic tangents.""" def check_tanh(): # Power-series multiplication and division verifies the n=3 Euler factors. count=85 current=[1]+[0]*(count-1) for k in range(1,4): numerator=[v-(current[m-k] if m>=k else 0) for m,v in enumerate(current)] for m in range(k,count): numerator[m]-=numerator[m-k] current=numerator weights={1:-2,2:2,3:2,4:4,6:-4} assert current[1:]==[sum(v for q,v in weights.items() if m%q==0) for m in range(1,count)] assert sum(q*v for q,v in weights.items())==0 if __name__ == "__main__": check_tanh() print("Exact finite check passed.")