// Run with Node.js: node twice-old-universe.mjs const trials = 100_000_000; const seed = 20261118; const referenceAge = 13.797; const ages = [referenceAge, 26.7, 2 * referenceAge]; const ageWindow = 0.10; // Gyr on either side of each target const hubbleTimeConversion = 977.79222168; const expansion = { hubble: 68.51, hubbleSigma: 0.58, matter: 0.2977, matterSigma: 0.0086 }; const distanceLadder = { hubble: 73.04, hubbleSigma: 1.04 }; const supernova = { exponent: 1.003, sigma: Math.hypot(0.005, 0.010), redshift: 1 }; const hybrid = { lookbackRatio: 1.144, ratio95: 0.042, tiredLightFactor: 1.159, factor95: 0.010 }; const silence = { onset: 4, expectedAtReference: [0.1, 1, 5] }; function uniformGenerator(seed) { let s0 = seed, s1 = 0x9e3779b9, s2 = 0x243f6a88, s3 = 0xb7e15162; const rotate = (x, k) => (x << k) | (x >>> (32-k)); return () => { const value = Math.imul(rotate(Math.imul(s1, 5), 7), 9); const t = s1 << 9; s2 ^= s0; s3 ^= s1; s1 ^= s2; s0 ^= s3; s2 ^= t; s3 = rotate(s3, 11); return ((value >>> 0) + 0.5) / 4294967296; }; } // Age in flat matter + cosmological-constant expansion, neglecting radiation. function hubbleForAge(age, matter) { return hubbleTimeConversion * 2 * Math.asinh(Math.sqrt((1-matter)/matter)) / (3 * Math.sqrt(1-matter) * age); } const random = uniformGenerator(seed); const expansionPass = Array(ages.length).fill(0); let expansionTotal = 0; const supernovaPass = [0, 0, 0]; const silenceCounts = silence.expectedAtReference.map(() => Array(ages.length).fill(0)); const remainingTime = ages.map(age => age - silence.onset); const logRedshift = Math.log1p(supernova.redshift); const desLow = Math.exp(logRedshift * (supernova.exponent - 1.96 * supernova.sigma)); const desHigh = Math.exp(logRedshift * (supernova.exponent + 1.96 * supernova.sigma)); const compatibleStretch = stretch => stretch >= desLow && stretch <= desHigh; for (let trial = 0; trial < trials; trial++) { const hubble = 20 + 80 * random(); const matter = 0.01 + 0.59 * random(); const insideExpansionScreen = Math.abs(hubble-expansion.hubble) <= 3*expansion.hubbleSigma && Math.abs(matter-expansion.matter) <= 3*expansion.matterSigma; if (insideExpansionScreen) { expansionTotal++; const age = hubbleForAge(1, matter) / hubble; for (let i = 0; i < ages.length; i++) { expansionPass[i] += Number(Math.abs(age-ages[i]) <= ageWindow); } } // Approximate the reported 95% margins as Gaussian. Covariance is unavailable. const radius = Math.sqrt(-2 * Math.log(random())); const angle = 2 * Math.PI * random(); const factor = hybrid.tiredLightFactor + hybrid.factor95 / 1.96 * radius * Math.cos(angle); const ratio = hybrid.lookbackRatio + hybrid.ratio95 / 1.96 * radius * Math.sin(angle); const directStretch = (1+supernova.redshift) / factor; supernovaPass[0] += Number(compatibleStretch(1+supernova.redshift)); supernovaPass[1] += Number(compatibleStretch(directStretch)); supernovaPass[2] += Number(compatibleStretch(directStretch * ratio)); // A paired draw of the first detectable event for all ages and rate scenarios. const wait = -Math.log(random()); for (let i = 0; i < silenceCounts.length; i++) { const rate = silence.expectedAtReference[i] / remainingTime[0]; for (let j = 0; j < ages.length; j++) { silenceCounts[i][j] += Number(wait > rate * remainingTime[j]); } } } const maxScreenAge = hubbleForAge(1, expansion.matter - 3*expansion.matterSigma) / (expansion.hubble - 3*expansion.hubbleSigma); const predictedStretch = [1+supernova.redshift, (1+supernova.redshift)/hybrid.tiredLightFactor, (1+supernova.redshift)*hybrid.lookbackRatio/hybrid.tiredLightFactor]; const exactSilence = silence.expectedAtReference.map(expected => remainingTime.map(time => Math.exp(-expected * time / remainingTime[0]))); console.log(JSON.stringify({ trials, seed, ages, ageWindow, expansion, distanceLadder, expansionTotal, expansionPass, maxScreenAge, hubbleRequired: ages.map(age => hubbleForAge(age, expansion.matter)), supernova, hybrid, desLow, desHigh, predictedStretch, supernovaPass, silence, silenceCounts, exactSilence }, null, 2));