ml-intern
File size: 2,712 Bytes
49f569e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""
PROBLEM 6: Lindelöf Hypothesis — Numerical Evidence
=====================================================
Lindelöf Hypothesis: ζ(1/2 + it) = O(t^ε) for all ε > 0
Best known: O(t^{13/84}) ≈ O(t^{0.155}) [Bourgain 2017]

Method:
  1. Compute |ζ(1/2 + it)| at the 100k zero ordinates t = γ_n
  2. Plot log|ζ(1/2+iγ_n)|/log(γ_n)
  3. If Lindelöf is true, this ratio → 0
  4. Estimate empirical exponent: |ζ(1/2+it)| ~ t^θ
"""

import numpy as np
from mpmath import zeta, mp, sqrt, log, exp
from typing import Dict


class LindeloefAnalyzer:
    def __init__(self, zeros: list):
        self.zeros = np.array(zeros)
        self.results = {}

    def analyze(self, n_samples: int = 2000) -> Dict:
        mp.dps = 15
        # Sample at logarithmically spaced zero indices
        indices = np.unique(np.logspace(0, np.log10(len(self.zeros)), n_samples).astype(int))
        indices = [i for i in indices if i > 0 and i <= len(self.zeros)]

        ratios = []
        zeta_abs = []
        gamma_vals = []

        for idx in indices:
            gamma = self.zeros[idx - 1]
            t = float(gamma)
            if t < 100:
                continue
            # Compute |ζ(1/2 + it)| — skip mpmath for speed, use approximation
            # Actually compute with lower precision for speed
            val = abs(zeta(0.5 + 1j * t))
            ratio = float(log(val) / log(t)) if val > 0 else 0
            ratios.append(ratio)
            zeta_abs.append(float(val))
            gamma_vals.append(t)

        ratios = np.array(ratios)
        gamma_vals = np.array(gamma_vals)

        # Fit θ in |ζ| ~ t^θ via log-log regression
        log_g = np.log(gamma_vals)
        log_z = np.log(zeta_abs)
        theta = float(np.polyfit(log_g, log_z, 1)[0])

        self.results = {
            'n_samples': len(ratios),
            'gamma_values': gamma_vals.tolist(),
            'zeta_abs': zeta_abs,
            'ratios': ratios.tolist(),
            'max_ratio': float(np.max(ratios)),
            'mean_ratio': float(np.mean(ratios)),
            'theta_estimate': theta,
            'bourgain_bound': 13.0 / 84.0,  # ≈ 0.155
            'lindeloef_satisfied': bool(theta < 0.3),  # heuristic
        }
        return self.results

    def summary(self) -> str:
        r = self.results
        s = f"Lindelöf Hypothesis Analysis\n{'='*50}\n"
        s += f"Samples: {r['n_samples']}\n"
        s += f"Estimated θ: {r['theta_estimate']:.4f} (|ζ| ~ t^θ)\n"
        s += f"Bourgain bound: {r['bourgain_bound']:.4f}\n"
        s += f"Lindelöf threshold (<0.3 heuristic): {r['lindeloef_satisfied']}\n"
        s += f"Max log|ζ|/log(t): {r['max_ratio']:.4f}\n"
        return s