  We establish identities of Pfaffian type for the theta function associated
with twice or half the period matrix of a hyperelliptic curve. They are implied
by the large size asymptotic analysis of exact Pfaffian identities for
expectation values of ratios of characteristic polynomials in ensembles of
orthogonal or quaternionic self-dual random matrices. We show that they amount
to identities for the theta function with the period matrix of a hyperelliptic
curve, and in this form we reprove them by direct geometric methods.
