5D Library › 塔罗超几何抽样、雷诺曼网格拓扑与卡巴拉生命树图论 · English

第一章 七十八张牌的超几何抽样

一副牌的结构

现代通行的塔罗牌有 78 张:22 张大阿卡纳(编号 0 到 21),以及四个花色的小阿卡纳,每个花色 14 张,即一到十的数字牌与侍从、骑士、王后、国王四张宫廷牌 (Dummett 1980)。程序中四个花色写作 W(权杖)、C(圣杯)、S(宝剑)、P(星币)。

一个牌阵是从洗过的牌堆顶上依次发出 nn 张牌。发出的牌不放回,所以「抽到大阿卡纳」不是一连串独立的硬币:前面每抽到一张大阿卡纳,后面抽到大阿卡纳的机会就小一点。设 KK 为牌阵中大阿卡纳的数量,它服从超几何分布

P(K=k)=(22k)(56n−k)(78n).P(K = k) = \frac{\binom{22}{k}\binom{56}{n-k}}{\binom{78}{n}}.

二项分布 p=22/78p = 22/78 是放回抽样的近似。两者的期望相同,方差相差一个有限总体修正因子 (78−n)/77(78-n)/77。

推导

# Chapter 1. p01: Majors in a spread - hypergeometric, not binomial.
# A tarot deck has 78 cards: 22 major arcana and 56 minor arcana in four
# suits of 14 (ace to ten, page, knight, queen, king). A spread deals n
# cards without replacement, so the number of majors K follows the
# hypergeometric law P(K = k) = C(22, k) C(56, n - k) / C(78, n).
# The binomial law with p = 22/78 is the with-replacement approximation.
from fractions import Fraction
from math import comb, factorial

N, MAJ = 78, 22

def hyper(n, k):
    return Fraction(comb(MAJ, k) * comb(N - MAJ, n - k), comb(N, n))

def binom(n, k):
    p = Fraction(MAJ, N)
    return comb(n, k) * p ** k * (1 - p) ** (n - k)

if __name__ == "__main__":
    print("   ordered upright/reversed 3-card spreads: {:,}".format(
        78 * 77 * 76 * 2 ** 3))
    print("   ordered upright/reversed 10-card spreads: {:,}".format(
        factorial(78) // factorial(68) * 2 ** 10))
    for n in (3, 10):
        mean = Fraction(n * MAJ, N)
        var = mean * Fraction(N - MAJ, N) * Fraction(N - n, N - 1)
        print("\n   n = {}: E[K] = {:.4f}, Var[K] = {:.4f} (binomial {:.4f})"
              .format(n, float(mean), float(var),
                      float(mean * Fraction(N - MAJ, N))))
        print("     k   hypergeometric   binomial")
        for k in range(0, min(n, 7) + 1):
            print("    {:2d}   {:14.5f}   {:8.5f}".format(
                k, float(hyper(n, k)), float(binom(n, k))))
        tail = sum(hyper(n, k) for k in range(n // 2, n + 1))
        print("     P(K >= {}) = {:.5f}".format(n // 2, float(tail)))
    no_major = hyper(10, 0)
    print("\n   10 cards with no major at all: {:.5f}".format(
        float(no_major)))
    print("   10 cards with 3 or more majors: {:.5f}".format(
        float(sum(hyper(10, k) for k in range(3, 11)))))
#    ordered upright/reversed 3-card spreads: 3,651,648
#    ordered upright/reversed 10-card spreads: 4,675,765,217,094,107,136,000
#
#    n = 3: E[K] = 0.8462, Var[K] = 0.5917 (binomial 0.6075)
#      k   hypergeometric   binomial
#      0          0.36437    0.37007
#      1          0.44534    0.43615
#      2          0.17004    0.17134
#      3          0.02024    0.02244
#      P(K >= 1) = 0.63563
#
#    n = 10: E[K] = 2.8205, Var[K] = 1.7883 (binomial 2.0250)
#      k   hypergeometric   binomial
#      0          0.02830    0.03639
#      1          0.13246    0.14294
#      2          0.26077    0.25271
#      3          0.28383    0.26474
#      4          0.18875    0.18201
#      5          0.07994    0.08580
#      6          0.02178    0.02809
#      7          0.00376    0.00631
#      P(K >= 5) = 0.10589
#
#    10 cards with no major at all: 0.02830
#    10 cards with 3 or more majors: 0.57847

三张牌阵带正逆位共有 3,651,648 种有序结果;十张的凯尔特十字有 4,675,765,217,094,107,136,000 种。三张牌中至少有一张大阿卡纳的概率为 0.63563,也就是说,大多数三张牌阵都含有大阿卡纳。十张牌中大阿卡纳的期望为 2.8205,方差 1.7883,比二项近似的 2.0250 小一成多;分布的尾部因此比二项分布更薄:五张以上大阿卡纳的概率为 0.10589,而二项近似在 k=6k = 6 与 k=7k = 7 处都给出偏高的值。三张以上大阿卡纳的概率为 0.57847,一张大阿卡纳都没有的概率为 0.02830。

凯尔特十字中大阿卡纳数量的分布:超几何(不放回)与二项近似(p01)。

注

「很多大阿卡纳」的门槛应当按超几何分布定。 若把「本次牌阵的大阿卡纳异常多」定义为最多 5% 的随机牌阵才会达到的数量,那么十张牌的门槛是六张:五张以上的概率仍有一成。

凯尔特十字:五色瓮

凯尔特十字的十张牌可以看成从一个装有五种颜色球的瓮中不放回地取十个:22 个大阿卡纳与四种各 14 个的花色。联合分布是多元超几何分布;所有满足总数为十的计数向量只有 1001 个,可以逐一精确求和,而不必模拟。

推导

# Chapter 1. p02: The Celtic Cross as a five-colour urn.
# Ten cards without replacement from five categories: 22 majors and four
# suits of 14 (wands W, cups C, swords S, pentacles P). The joint law is
# multivariate hypergeometric; we enumerate every count vector exactly.
# Courts: 16 cards (4 per suit). Rank pairs: two minors of the same rank
# (14 ranks x 4 suits); majors have no rank partner.
from fractions import Fraction
from itertools import product
from math import comb

TOT = comb(78, 10)

def suit_law():
    law = {}
    for a, b, c, d in product(range(11), repeat=4):
        m = 10 - a - b - c - d
        if m < 0:
            continue
        w = comb(22, m) * comb(14, a) * comb(14, b) * comb(14, c) \
            * comb(14, d)
        law[(m, a, b, c, d)] = Fraction(w, TOT)
    return law

def distinct_ranks(k):
    # k minors from 56 with all ranks different
    return Fraction(comb(14, k) * 4 ** k, comb(56, k))

if __name__ == "__main__":
    law = suit_law()
    print("   count vectors enumerated: {}; total probability {}".format(
        len(law), sum(law.values())))
    top = {}
    for (m, *s), p in law.items():
        top[max(s)] = top.get(max(s), 0) + p
    print("   largest single-suit count among the ten cards:")
    for k in range(0, 8):
        print("     {:2d}  {:.5f}".format(k, float(top.get(k, 0))))
    ge4 = sum(p for k, p in top.items() if k >= 4)
    print("   P(some suit appears 4+ times) = {:.5f}".format(float(ge4)))
    miss = sum(p for (m, *s), p in law.items() if min(s) == 0)
    print("   P(at least one suit absent)   = {:.5f}".format(float(miss)))
    court = [Fraction(comb(16, k) * comb(62, 10 - k), TOT)
             for k in range(11)]
    print("   courts: E = {:.4f}; P(3+) = {:.5f}; P(0) = {:.5f}".format(
        10 * 16 / 78, float(sum(court[3:])), float(court[0])))
    pair = 0
    for k in range(11):
        pk = Fraction(comb(56, k) * comb(22, 10 - k), TOT)
        pair += pk * (1 - distinct_ranks(k) if k <= 14 else 1)
    print("   P(two minors share a rank)    = {:.5f}".format(float(pair)))
    aces = Fraction(comb(4, 2) * comb(74, 8), TOT)
    print("   P(exactly two aces)           = {:.5f}".format(float(aces)))
#    count vectors enumerated: 1001; total probability 1
#    largest single-suit count among the ten cards:
#       0  0.00000
#       1  0.00409
#       2  0.20619
#       3  0.50294
#       4  0.23173
#       5  0.04850
#       6  0.00607
#       7  0.00045
#    P(some suit appears 4+ times) = 0.28678
#    P(at least one suit absent)   = 0.43334
#    courts: E = 2.0513; P(3+) = 0.33416; P(0) = 0.08545
#    P(two minors share a rank)    = 0.75189
#    P(exactly two aces)           = 0.07186

程序给出几类读者常会注意的「聚集」的基率。某个花色出现四次以上的概率为 0.28678;至少缺一个花色的概率为 0.43334。十张牌中宫廷牌的期望为 2.0513 张,三张以上的概率为 0.33416,一张都没有的概率为 0.08545。两张小阿卡纳同点(例如两张「五」)的概率为 0.75189;恰有两张 A 的概率为 0.07186。

假说 · 尚未验证

作者的假说(尚未验证): 解读者对「花色聚集」「宫廷牌聚集」的直觉门槛,普遍低于超几何分布的 5% 门槛,因而把基率在两成到三成之间的组合当作「有意义的模式」。什么会证明它错: 若在盲法条件下请解读者为随机牌阵标出「值得注意的聚集」,被标出的牌阵中这些组合的基率都低于百分之五,这一假说就不成立。

小结

牌阵中各类牌的数量服从超几何与多元超几何分布,可以精确计算。十张牌中三张以上大阿卡纳、某个花色四张以上、三张以上宫廷牌、两张同点,基率分别约为六成、三成、三分之一与四分之三。这些数字是讨论任何「模式」之前必须先放在桌上的基线。

参考文献

Dummett, Michael. 1980. The Game of Tarot: From Ferrara to Salt Lake City. Duckworth.

Fan, Y. (2026). Tarot Hypergeometric Sampling, Lenormand Grid Topology and Kabbalistic Tree Graphs: Reversal Binomial Mixtures, Grand-Tableau Manhattan Distances and Twenty-Two-Edge Spectral Centrality [塔罗超几何抽样、雷诺曼网格拓扑与卡巴拉生命树图论] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090191 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).