Heuristic Computation and the Discovery of Mersenne Primes

Heuristic Computation and the Discovery of Mersenne Primes Heuristic Computation and the Discovery of Mersenne Primes “Where Strategy Meets Infinity: The Quest for Mersenne Primes” Introduction: The Dance of Numbers and Heuristics Mersenne primes are not just numbers—they are milestones in the vast landscape of mathematics. Defined by the formula: \[ M_p = 2^p - 1 \] where \( p \) is itself prime, these giants challenge our computational limits and inspire new methods of discovery. But why are these primes so elusive? As \( p \) grows, the numbers become astronomically large, making brute-force testing impossible. This is where heuristic computation steps in—guiding us with smart, experience-driven strategies. “In the infinite sea of numbers, heuristics are our compass.” Let’s explore how heuristics and algorithms intertwine to unveil these mathematical treasures. 1. Mersenne Primes — Giants of Number Theory Definition: Numbers of the form \( M_p = 2^p - 1 \...

The Distributional Derivative of ln(x): Theory, Regularization & Computational Insights

The Distributional Derivative of ln(x): Theory, Regularization & Computational Insights

From Logarithms to Distributions: Understanding \( \ln(x) \) and Its Generalized Derivatives with Python/SageMath

Introduction: Why Logarithms Need Special Treatment

Why can't we just differentiate \( \ln(x) \) as usual? What happens at \( x=0 \)
Functions like \( \ln(x) \) pose problems in calculus because of their singular behavior near zero. To deal with such functions rigorously, we need to extend the concept of derivatives beyond classical calculus.

  • Have you ever wondered how calculus extends to functions that blow up or behave badly? Let’s explore this together.

1. Theoretical Foundation: What Are Generalized Functions?

Distributions (or generalized functions) let us work with derivatives of functions like \( \ln(x) \) by shifting the focus from pointwise behavior to integrals against smooth test functions.
We define the distributional derivative of \( \ln(x) \) as: \[ \left\langle \frac{d}{dx} \ln x, \varphi(x) \right\rangle = -\left\langle \ln x, \varphi'(x) \right\rangle \] This expression cannot be evaluated directly because \( \ln(x) \) diverges at \( x=0 \)
Instead, we define it using the Cauchy Principal Value: \[ \left\langle \frac{d}{dx} \ln x, \varphi(x) \right\rangle = \text{p.v.} \int_{-\infty}^{\infty} \frac{\varphi(x)}{x} \, dx \] We now interpret \( \frac{1}{x} \) not as a classical function but as a distribution, using this regularization.

Alternative but Equivalent Definition:

\[ \left\langle \frac{d}{dx} \ln |x|, \varphi \right\rangle = \int_{0}^{\infty} \frac{\varphi(x) - \varphi(-x)}{x} \, dx \]

Regularization and Principal Value — Taming the Singularity

Think of \( \frac{1}{x} \) as a tightrope walker: to stay balanced, you must equally weigh contributions from both sides of \( x=0 \)

Regularized Log Function Plot

      
import numpy as np
import matplotlib.pyplot as plt

x_vals = np.linspace(-2, 2, 400)
eps_vals = [0.1, 0.01, 0.001]

plt.figure(figsize=(8, 5))
for eps in eps_vals:
    y_vals = np.log(np.abs(x_vals) + eps)
    plt.plot(x_vals, y_vals, label=f'ฮต = {eps}')

plt.axvline(0, color='gray', linestyle='--')
plt.legend()
plt.title("Regularized ln |x| for different ฮต")
plt.xlabel("x")
plt.ylabel("ln |x|")
plt.show()
	
    

๐Ÿ’ก Try It Yourself! Now You can copy and paste directly into here Run SageMath Code Here

This plot shows how \( \ln(x) \) is smoothed near \( x=0 \) using different regularization values ฮต.

SageMath + Python: Symbolic & Numerical Verification

SageMath: Symbolic Integration

      
from sage.all import *

# Define variables
x, epsilon = var('x epsilon')
phi = function('phi')(x)

# Define function and its derivative
lnx = log(abs(x))
phi_prime = diff(phi, x)

# Compute distributional derivative using integration by parts
distributional_derivative = -integrate(lnx * phi_prime, (x, epsilon, +Infinity)) \
                            -integrate(lnx * phi_prime, (x, -Infinity, -epsilon))

# Show the result
show(distributional_derivative)
	
    

This code symbolically represents the generalized derivative using distribution pairing.

Python (SymPy + SciPy): Numerical Approximation

      
import numpy as np
from scipy.integrate import quad
import matplotlib.pyplot as plt

# Define phi_prime function
phi_prime = lambda x: -2 * x * np.exp(-x**2)
lnx_phi_prime = lambda x: np.log(abs(x)) * phi_prime(x)

# Compute the principal value integral
def principal_value(eps):
    if eps <= 0:
        raise ValueError("ฮต must be positive to avoid singularity")
    I1, _ = quad(lnx_phi_prime, -1000, -eps)
    I2, _ = quad(lnx_phi_prime, eps, 1000)
    return -(I1 + I2)

# Generate data points
eps_list = np.logspace(-3, -1, 10)
pv_values = [principal_value(eps) for eps in eps_list]

# Plot results
plt.figure(figsize=(8, 5))
plt.plot(eps_list, pv_values, linestyle='-', marker='o', color='b')
plt.xscale("log")
plt.title("Principal Value Integral Convergence")
plt.xlabel("ฮต")
plt.ylabel("Integral value")
plt.grid(True)
plt.text(eps_list[-1], pv_values[-1], "Final Value", fontsize=12)
plt.show() 
	
    

This plot demonstrates how the principal value stabilizes as ฮต → 0.

Next upcoming

Next time, We’ve explored the generalized derivative of \( \ln(x) \) on the real line. But what happens if we approach zero from the complex plane?

Coming Soon: Derivative of \( \ln(x + i0)\)

We’ll look at:

  • The complexified version: \[ \ln(x + i0) = \lim_{y \to 0^+} \ln(x + iy) \]
  • The imaginary part jump across the real line
  • Connection to the Hilbert transform and the Sokhotski–Plemelj theorem
  • Stay tuned for plots showing the discontinuity of \( \ln(x + i0) \) across the real axis!

    ๐Ÿ’ก Try It Yourself! Now You can copy and paste directly into here Run SageMath Code Here

    Bonus Challenge for You!

    Can you compute the principal value of this integral? \[ \text{p.v.} \int_{-\infty}^{\infty} \frac{\sin x}{x} \, dx \] Or test yourself:

    What is the distributional derivative of \( \ln(x^2) \)?

Comments

Popular posts from this blog

๐ŸŒŸ Illuminating Light: Waves, Mathematics, and the Secrets of the Universe

Spirals in Nature: The Beautiful Geometry of Life