Post
Topic
Board Off-topic
Re: Spectral Math Unlocks Bitcoin Private Keys?
by
PAPASO
on 11/05/2025, 02:43:32 UTC
# n = 10000

import numpy as np
import matplotlib.pyplot as plt

# Step 1:
n_samples = 10000
k_values = np.linspace(1e3, 1e6, n_samples)
x_Q = np.linspace(0.5, 2.0, n_samples)
y_Q = np.linspace(1.0, 3.0, n_samples)
a_curve = np.linspace(1, 3, n_samples)
b_curve = np.linspace(-1, 2, n_samples)
xy = x_Q + y_Q

# Hecke
a_p = np.array([1.0, -1.0, 0.0, 2.0, -2.0, 1.0, -1.0, 3.0, -3.0, 2.0, 0.0, -2.0])
P = len(a_p)

# Step 2:
X_parts = []
for i in range(P):
    for r in range(1, 6):
        X_parts.append(a_p * (xy ** r))
        X_parts.append(a_p * (a_curve ** r))
        X_parts.append(a_p * (b_curve ** r))
X = np.column_stack(X_parts)

# Step 3:
coeffs, _, _, _ = np.linalg.lstsq(X, k_values, rcond=None)
k_pred = X @ coeffs

# Step 4:
mse = np.mean((k_pred - k_values) ** 2)
max_err = np.max(np.abs(k_pred - k_values))
mean_err = np.mean(np.abs(k_pred - k_values))

#
print("\nMultivariable Spectral Regression (n = 10000)")
print("=" * 70)
print(f"MSE:             {mse:.6e}")
print(f"Max Error:       {max_err:.6f}")
print(f"Mean Error:      {mean_err:.6f}")
print(f"First 5 k (true):     {np.round(k_values[:5], 3).tolist()}")
print(f"First 5 k (predicted):{np.round(k_pred[:5], 3).tolist()}")

#
plt.figure(figsize=(8, 5))
plt.plot(k_values[:100], k_values[:100], 'k--', label='Ideal')
plt.plot(k_values[:100], k_pred[:100], 'o-', label='Predicted')
plt.xlabel("True k")
plt.ylabel("Predicted k")
plt.title("Multivariable Spectral Fit: Hecke a_p → Scalar k (n = 10000)")
plt.grid(True)
plt.legend()
plt.tight_layout()
plt.show()


Multivariable Spectral Regression (n = 10000)
======================================================================
MSE:             3.320705e-16
Max Error:       0.000000
Mean Error:      0.000000
First 5 k (true):     [1000.0, 1099.91, 1199.82, 1299.73, 1399.64]
First 5 k (predicted):[1000.0, 1099.91, 1199.82, 1299.73, 1399.64]
2025-05-10 19:40:21.196 Python[38006:21957039] +[IMKClient subclass]: chose IMKClient_Modern
2025-05-10 19:40:21.196 Python[38006:21957039] +[IMKInputSession subclass]: chose IMKInputSession_Modern