import numpy as np
import matplotlib.pyplot as plt
# Parameters
a = 1.0
alpha = 10.0
lambda_d = 10.0
k_d = 2 * np.pi / lambda_d
# Spatial grid
x = np.linspace(-40, 40, 2000)
# 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 imaginary part
eta_imag = np.imag(eta_x0)
plt.figure(figsize=(7, 4.5))
plt.plot(x, eta_imag, 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"$\Im\{\eta(x,0)\}$")
plt.title(
r"Plot of $\Im\{\eta(x,0)\}$ for $\alpha=10\,\mathrm{m}$ and "
r"$k_d=2\pi/10\,\mathrm{m}^{-1}$"
)
plt.tight_layout()
plt.show()