# Controle independant de la perte de masse du minorant affine de [A], eq. (4.2)-(4.6) : # kappa_true = 6 u^4 * integrale sur P_E de dz / prod_{i=1..5} (1/5 + u z_i), u = a - 2/5, a = 41361/100000. # Integration exacte par developpement en serie sur les trois simplexes de la triangulation donnee (formule de Dirichlet). from fractions import Fraction as Fr from itertools import product from math import factorial V=[[Fr(-1,3)]*4,[Fr(0)]*4,[Fr(1,2),Fr(1,2),Fr(-3,4),Fr(-3,4)],[Fr(1,2),Fr(1,2),Fr(-1,3),Fr(-1,3)], [Fr(1,2),Fr(1,2),Fr(1,2),Fr(-2)],[Fr(1,2),Fr(1,2),Fr(1,2),Fr(-3,4)],[Fr(4,3),Fr(-1,3),Fr(-1,3),Fr(-1,3)]] S=[(0,1,3,5,6),(0,2,3,5,6),(0,2,4,5,6)] def det(M): M=[r[:] for r in M]; n=len(M); d=Fr(1) for i in range(n): p=next((r for r in range(i,n) if M[r][i]!=0),None) if p is None: return Fr(0) if p!=i: M[i],M[p]=M[p],M[i]; d=-d d*=M[i][i] for r in range(i+1,n): f=M[r][i]/M[i][i] for c_ in range(i,n): M[r][c_]-=f*M[i][c_] return d vols=[abs(det([[V[s[j]][i]-V[s[0]][i] for i in range(4)] for j in range(1,5)]))/24 for s in S] print("volumes :",vols,"somme",sum(vols),"(annonce 125/864)") # integrale de prod 1/(1/5+u z_i) sur chaque simplexe : quadrature de Gauss tensorielle (transformation de Duffy), flottants import numpy as np u=float(Fr(41361,100000)-Fr(2,5)) def integ(s,n=24): x,w=np.polynomial.legendre.leggauss(n); x=(x+1)/2; w=w/2 P=np.array([[float(V[j][i]) for i in range(4)] for j in s]) tot=0.0 for (i1,i2,i3,i4) in product(range(n),repeat=4): a1,a2,a3,a4=x[i1],x[i2],x[i3],x[i4] # coordonnees barycentriques par Duffy : t1=a1, t2=(1-a1)a2, t3=(1-a1)(1-a2)a3, t4=(1-a1)(1-a2)(1-a3)a4, t0=reste t1=a1; t2=(1-a1)*a2; t3=(1-a1)*(1-a2)*a3; t4=(1-a1)*(1-a2)*(1-a3)*a4; t0=1-t1-t2-t3-t4 jac=(1-a1)**3*(1-a2)**2*(1-a3) z=t0*P[0]+t1*P[1]+t2*P[2]+t3*P[3]+t4*P[4]; z5=-z.sum() tot+=w[i1]*w[i2]*w[i3]*w[i4]*jac/(np.prod(0.2+u*z)*(0.2+u*z5)) return tot tot=0.0 for s,v in zip(S,vols): tot+=integ(s,14)*float(v)*24 # volume du simplexe = |det|/24 ; integrale = |det| * int_Duffy k=6*u**4*tot print("kappa_true (quadrature independante) = %.15e"%k) print("[A] annonce 0.000093307088324061 < kappa_true < 0.000093307088324062")