import numpy as np
import matplotlib.pyplot as plt
from mpmath import zetazero, zeta, findroot
def plot_riemann_zeta_zeros(n_zeros):
"""Plot the first n_zeros non-trivial zeros of the Riemann zeta function."""
# Get the first n_zeros non-trivial zeros
zeros = [zetazero(n) for n in range(1, n_zeros + 1)]
real_parts = [zero.real for zero in zeros]
imaginary_parts = [zero.imag for zero in zeros]
# Plot the zeros on the complex plane
plt.figure(figsize=(10, 6))
plt.scatter(real_parts, imaginary_parts, color='red', marker='x', label='Non-trivial zeros')
plt.axhline(0, color='black', lw=0.5)
plt.axvline(0.5, color='blue', lw=0.5, linestyle='--', label='Critical Line (Re=0.5)')
plt.xlabel('Real Part')
plt.ylabel('Imaginary Part')
plt.title('Non-trivial Zeros of the Riemann Zeta Function')
plt.legend()
plt.grid(True)
plt.show()
# Example usage
plot_riemann_zeta_zeros(200)
No comments:
Post a Comment