// docs/edsac.svg: Birch and Swinnerton-Dyer's experiment, redone. For the curve of least known conductor of each rank 0 // to 5, the product over good primes p <= X of N_p / p (N_p: the points mod p, the one at infinity included) against X // on log log axes, where a curve's slope tends to its rank. Each line is labelled with its rank and its slope fitted over // X = 1,000 to 100,000. Light or dark as the reader's system is. About 20 s. // node scripts/edsac-figure.mjs > docs/edsac.svg // The counting is the same as the column's playground (public/millennium/bsd-edsac.html on the site). const TOP = 100000, LO = 1000 const CURVES = [ // label, [a1, a2, a3, a4, a6], rank: Cremona's tables, and the LMFDB for 19047851.a1 ['11a1', [0, -1, 1, -10, -20], 0], ['37a1', [0, 0, 1, -1, 0], 1], ['389a1', [0, 1, 1, -2, 0], 2], ['5077a1', [0, 0, 1, -7, 6], 3], ['234446a1', [1, -1, 0, -79, 289], 4], ['19047851a1', [0, 0, 1, -79, 342], 5]] function primes(n) { const s = new Uint8Array(n + 1), out = []; for (let i = 2; i <= n; i++) if (!s[i]) { out.push(i); for (let j = i * i; j <= n; j += i) s[j] = 1 } return out } const mod = (a, p) => ((a % p) + p) % p // N_p for y^2 + a1 xy + a3 y = x^3 + a2 x^2 + a4 x + a6 at an odd good prime: (2y + a1 x + a3)^2 = f(x) = // 4x^3 + b2 x^2 + 2 b4 x + b6, so N_p = p + 1 + sum over x of the Legendre symbol of f(x), f stepped by differences function count([a1, a2, a3, a4, a6], p, sq) { const b2 = mod(a1 * a1 + 4 * a2, p), b4 = mod(2 * a4 + a1 * a3, p), b6 = mod(a3 * a3 + 4 * a6, p) sq.fill(0, 0, p) for (let x = 1, y = 1; x <= (p - 1) / 2; x++) { sq[y] = 1; y += 2 * x + 1; while (y >= p) y -= p } let F = b6, D1 = mod(4 + b2 + 2 * b4, p), D2 = mod(24 + 2 * b2, p), s = 0 const D3 = 24 % p for (let x = 0; x < p; x++) { if (F) s += sq[F] ? 1 : -1 F += D1; if (F >= p) F -= p D1 += D2; if (D1 >= p) D1 -= p D2 += D3; if (D2 >= p) D2 -= p } return p + 1 + s } function disc([a1, a2, a3, a4, a6]) { const b2 = a1 * a1 + 4 * a2, b4 = 2 * a4 + a1 * a3, b6 = a3 * a3 + 4 * a6 const b8 = a1 * a1 * a6 + 4 * a2 * a6 - a1 * a3 * a4 + a2 * a3 * a3 - a4 * a4 return -b2 * b2 * b8 - 8 * b4 ** 3 - 27 * b6 * b6 + 9 * b2 * b4 * b6 // small coefficients: exact in doubles } function run(a) { const sq = new Uint8Array(TOP + 1), D = disc(a), pts = [] let lf = 0 for (const p of primes(TOP)) { if (p === 2 || D % p === 0) continue // p = 2 changes no slope; the bad primes are left out, as BSD's product does lf += Math.log(count(a, p, sq) / p) pts.push([p, lf]) } return pts } // the slope against log log X of the running sum sampled evenly in log X, as the 1960s plots were read function slope(pts) { const k = 120, xs = [], ys = [] let j = 0 for (let i = 0; i < k; i++) { const x = LO * (TOP / LO) ** (i / (k - 1)) while (j + 1 < pts.length && pts[j + 1][0] <= x) j++ xs.push(Math.log(Math.log(x))); ys.push(pts[j][1]) } const mx = xs.reduce((a, b) => a + b) / k, my = ys.reduce((a, b) => a + b) / k let sxy = 0, sxx = 0 for (let i = 0; i < k; i++) { sxy += (xs[i] - mx) * (ys[i] - my); sxx += (xs[i] - mx) ** 2 } return sxy / sxx } const W = 720, H = 360, L = 46, R = W - 86, T = 12, B = H - 28 const LIGHT = ['#9cc3cc', '#6fa6b4', '#3f879a', '#1f6d82', '#0b566a', '#03404f'], DARK = ['#3f6e79', '#4f8b99', '#68a8b6', '#8cc4d0', '#b3dde6', '#dff3f7'] const X0 = Math.log(Math.log(10)), X1 = Math.log(Math.log(TOP)) const X = x => L + (Math.log(Math.log(x)) - X0) / (X1 - X0) * (R - L) const runs = CURVES.map(([label, a, rank]) => { const pts = run(a), s = slope(pts); console.error(label, 'rank', rank, 'slope', s.toFixed(3)); return { rank, pts, s } }) const top = Math.ceil(Math.max(...runs.map(r => r.pts.at(-1)[1])) / Math.LN10) * Math.LN10 const Y = v => B - Math.max(0, v) / top * (B - T) const num = v => (Math.round(v * 10) / 10).toString() const sup = n => String(n).replace(/[0-9]/g, d => '⁰¹²³⁴⁵⁶⁷⁸⁹'[d]) const out = [``, 'Birch and Swinnerton-Dyer’s product for the smallest curves of rank 0 to 5', ``, ``] for (let e = 0; e * Math.LN10 <= top + 1e-9; e++) { const y = Math.round(Y(e * Math.LN10)) + 0.5; out.push(`${e === 0 ? '1' : e === 1 ? '10' : '10' + sup(e)}`) } for (const [x, t] of [[10, '10'], [100, '100'], [1000, '1,000'], [1e5, '100,000']]) out.push(`${t}`) out.push(`∏ Nₚ/pp ≤ X`) const lastY = [] for (const { rank, pts, s } of runs) { // the running product sampled at 400 points evenly in log log X, a step at each prime const d = [] let j = 0 for (let i = 0; i <= 400; i++) { const x = Math.exp(Math.exp(X0 + (X1 - X0) * i / 400)) while (j + 1 < pts.length && pts[j + 1][0] <= x) j++ d.push(`${i ? 'L' : 'M'}${num(X(x))} ${num(Y(pts[j][0] <= x ? pts[j][1] : 0))}`) } out.push(``) let ly = Y(pts.at(-1)[1]) + 4 for (const o of lastY) if (Math.abs(o - ly) < 13) ly = o - 13 lastY.push(ly) out.push(`${rank} · ${s.toFixed(2)}`) } out.push('') console.log(out.join('\n'))