program.py

back to table · edit · history · where entries came from · files · download

865 bytes, as of the version from 2026-10-28 05:42 (current). Recorded here, not run.

import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
from sage.rings.real_arb import RealBallField

def bures_volume(field, N, r, digits=100):
    beta = {"real": 1, "complex": 2}[field]
    if N < 2 or not 1 <= r <= N:
        raise ValueError("need N >= 2 and 1 <= r <= N")
    R = RealBallField(numberdb.bits(digits, losing=128))
    d = N-r
    D = r-1 + beta*r*(2*N-r-1)//2
    v = R.pi()**(QQ(D+1)/2) / (R(2)**D * R(QQ(D+1)/2).gamma())
    for j in range(1, r+1):
        v *= R(QQ(j*beta)/2).gamma() * R(1+QQ((2*d+j-1)*beta)/2).gamma()
        v /= R(QQ((d+j)*beta)/2).gamma() * R(1+QQ((d+j-1)*beta)/2).gamma()
    return v

# One more value:
bures_volume("complex", 3, 2)
# The table's selection:
# for field in ("real", "complex"):
#     for N in range(2, 17):
#         for r in range(1, N+1):
#             bures_volume(field, N, r)