#!/usr/bin/env python3 """Arithmetic checks of numbers in Kato & Hachisu (2026), rules C and part of B. No download is read. All inputs are typed from the paper with locators, and the result is printed and written to /paper_checks.txt. Usage: python -I paper_checks.py """ import math import os import sys G = 6.674e-8 MSUN = 1.989e33 RSUN = 6.957e10 DAY = 86400.0 def kepler_a(m1, m2, p_day): return (G * (m1 + m2) * MSUN * (p_day * DAY) ** 2 / (4 * math.pi**2)) ** (1.0 / 3) / RSUN def eggleton(q): """RL/a for the star whose mass ratio to the other is q (Eggleton 1983).""" return 0.49 * q ** (2.0 / 3) / (0.6 * q ** (2.0 / 3) + math.log(1 + q ** (1.0 / 3))) def dist_kpc(mod_v, ebv, rv=3.1): return 10 ** ((mod_v - rv * ebv) / 5 + 1) / 1000 def planck_photons(x): return x * x / (math.exp(x) - 1) def q_above(temp, e_ev, n=20000, xmax=200.0): kt = 8.617333e-5 * temp x0 = e_ev / kt if x0 >= xmax: return 0.0 # integrate photon number above x0 with Simpson on a log-spaced grid a, b = math.log(x0), math.log(xmax) h = (b - a) / n s = 0.0 for i in range(n + 1): u = a + i * h x = math.exp(u) f = planck_photons(x) * x w = 1 if i in (0, n) else (4 if i % 2 else 2) s += w * f return s * h / 3 def main(): out = sys.argv[1] os.makedirs(out, exist_ok=True) L = [] def p(*a): L.append(" ".join(str(x) for x in a)) p("Distances from Table 1, d = 10^((m-M)V - 3.1 E(B-V))/5 + 1):") for name, mod, ebv, d in [ ("V1674 Her", 16.3, 0.5, 8.9), ("KT Eri", 13.4, 0.08, 4.2), ("HR Del", 10.4, 0.15, 0.97), ("V723 Cas", 14.0, 0.35, 3.85), ("V5558 Sgr", 13.9, 0.7, 2.2), ("Gaia22alz", 17.35, 0.9, 8.15), ("PU Vul", 14.3, 0.3, 4.7), ("CN Cha", 12.9, 0.17, 3.05)]: p(" %-10s computed %.2f kpc, Table 1 %.2f kpc" % (name, dist_kpc(mod, ebv), d)) p(" Gaia22alz range for (m-M)V 17.15-17.55: %.2f to %.2f kpc" % (dist_kpc(17.15, 0.9), dist_kpc(17.55, 0.9))) p(" Gaia22alz for E(B-V) 0.5 and 1.13: %.1f and %.1f kpc" % (dist_kpc(17.35, 0.5), dist_kpc(17.35, 1.13))) p(" Quiescent MV = 18.4 - 17.35 = %.2f (paper 1.0)" % (18.4 - 17.35)) p("\nOrbit for Porb = 1.437 d:") a = kepler_a(0.6, 0.2, 1.437) q2 = 0.2 / 0.6 r2 = eggleton(q2) * a r1 = eggleton(1 / q2) * a p(" a(0.6+0.2) = %.3f Rsun (paper 5.0, Fig. 8 caption 4.97)" % a) p(" Roche radius of the 0.2 Msun donor = %.3f Rsun; of the WD = %.3f Rsun" % (r2, r1)) p(" Near side of donor reaches the photosphere at R = a - R2 = %.3f Rsun" % (a - r2)) for m2 in (0.2, 0.4, 0.6, 0.8, 1.0, 1.5): aa = kepler_a(0.6, m2, 1.437) rr2 = eggleton(m2 / 0.6) * aa p(" m2=%.1f: a=%.2f Rsun, R2=%.2f Rsun, a-R2=%.2f" % (m2, aa, rr2, aa - rr2)) p(" The days these radii are reached come from the plotted curves, radius_curves.py (rule N8). An earlier version interpolated between radii of two different models here, and that is withdrawn.") p("\nRounds, §4.4: engulfed day 55, point C day 106, first peak day 177, P = 1.437 d") p(" (106-55)/P = %.1f (paper 35)" % ((106 - 55) / 1.437)) p(" (177-106)/P = %.1f (paper 49)" % ((177 - 106) / 1.437)) p(" Orbital period of the same orbit at a=5.0: Kepler gives P=%.3f d" % (2 * math.pi * math.sqrt((5.0 * RSUN) ** 3 / (G * 0.8 * MSUN)) / DAY)) p("\nOther periods in Table 1, in hours: HR Del %.2f (paper 5.14), V723 Cas %.1f (paper 16.6), V5558 Sgr 0.1858 d = %.2f (paper 4.46)" % (0.214 * 24, 0.693 * 24, 0.1858 * 24)) p("\nBlackbody photon budget (rule C). He II 4686/Hbeta = 12.2 x (2.59e-13/1.53e-12) x Qr = %.2f x Qr, Case B at 10^4 K" % (12.2 * 2.59 / 15.3)) fac = 12.2 * 2.59 / 15.3 for logt in (4.0, 4.48, 4.7, 5.0, 5.3, 5.48, 5.7): t = 10**logt qh = q_above(t, 13.6) qhe = q_above(t, 54.4) qr = qhe / qh p(" log T=%.2f (%.0f K): Q(He+)/Q(H) = %.3e ; predicted He II 4686/Hbeta = %.3e" % (logt, t, qr, fac * qr)) # X-ray and UV shares of the blackbody at point A and the model's maximum temperature p("\nShare of blackbody energy, for scale:") def energy_above(temp, e_ev, n=20000, xmax=200.0): kt = 8.617333e-5 * temp x0 = e_ev / kt if x0 >= xmax: return 0.0 a0, b0 = math.log(x0), math.log(xmax) h = (b0 - a0) / n s = 0.0 for i in range(n + 1): x = math.exp(a0 + i * h) f = x**3 / (math.exp(x) - 1) * x w = 1 if i in (0, n) else (4 if i % 2 else 2) s += w * f return s * h / 3 / (math.pi**4 / 15) for logt in (4.48, 5.0, 5.37, 5.46): t = 10**logt e_uv = energy_above(t, 13.6) - energy_above(t, 300.0) e_x = energy_above(t, 300.0) - energy_above(t, 1000.0) e_opt = energy_above(t, 1.65) - energy_above(t, 3.26) p(" log T=%.2f: 0.3-1 keV %.2e, 13.6-300 eV %.3f, optical 1.65-3.26 eV %.2e of the bolometric" % (logt, e_x, e_uv, e_opt)) p("\nInflow factor, §3.2 and Table 2: Lnuc/Lph against the assumed f_i") for name, lph, lnuc, fi in [("M06.Ne.047", 1.16e4, 0.18e7, 2), ("M06.Ne.11", 1.08e4, 2.8e7, 41), ("M06.Ne.25", 0.976e4, 350e7, 1001)]: p(" %s: Lnuc/Lph = %.0f ; f_i = %d ; ratio %.1f" % (name, lnuc / lph, fi, lnuc / lph / fi)) p(" With Eq. (2), dt scales as 1/(f-1), so f_i of 2, 41, 1001 changes the early time step by a factor of 1, 40, 1000 for fixed dE and Lph.") with open(os.path.join(out, "paper_checks.txt"), "w", encoding="utf-8", newline="\n") as fh: fh.write("\n".join(L) + "\n") print("\n".join(L)) if __name__ == "__main__": main()