import numpy as np
import matplotlib.pyplot as plt
# Parameters
a = 1.0 # amplitude scale (can be arbitrary)
alpha = 10.0 # m
lambda_d = 10.0 # m
k_d = 2 * np.pi / lambda_d # dominant wave number (m^-1)
# Spatial grid
x = np.linspace(-40, 40, 2000) # m
# Initial surface shape η(x,0)
eta_x0 = (a / (np.sqrt(2*np.pi) * alpha)) * np.exp(
-x**2 / (2 * alpha**2) + 1j * k_d * x
)
# Take the real part
eta_real = np.real(eta_x0) # eta_imag = np.imag(eta_x0)
plt.figure(figsize=(7, 4.5))
plt.plot(x, eta_real, color='black', linewidth=1.5)
plt.axhline(0, color='black', linewidth=0.8)
plt.xlim(-40, 40)
plt.xlabel(r"$x$ (m)")
plt.ylabel(r"$\Re\{\eta(x,0)\}$")
plt.title(
r"Plot of $\Re\{\eta(x,0)\}$ for $\alpha=10\,\mathrm{m}$ and "
r"$k_d=2\pi/10\,\mathrm{m}^{-1}$"
)
plt.tight_layout()
plt.show()