Example: Group Velocity and Dispersion of a Gaussian Wave Packet in Deep Water
\(\Re\{\eta(x,0)\}\) and \(\Im\{\eta(x,0)\}\)
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
)
eta_real = np.real(eta_x0)
eta_imag = np.imag(eta_x0)

plt.figure(figsize=(8, 5))
plt.plot(x, eta_real, label=r"$\Re\{\eta(x,0)\}$", linewidth=1.5, color = "black")
plt.plot(x, eta_imag, linestyle='--', label=r"$\Im\{\eta(x,0)\}$", linewidth=2.0, color = "#7DCDF4")
plt.axhline(0, color='black', linewidth=0.8)
plt.xlim(-40, 40)
plt.xlabel(r"$x$ (m)")
plt.ylabel(r"$\eta(x,0)$")
plt.title(
    r"Real and Imaginary Parts of $\eta(x,0)$"
    "\n"
    r"$\alpha=10\,\mathrm{m},\quad k_d=2\pi/10\,\mathrm{m}^{-1}$"
)
plt.legend()
plt.tight_layout()
plt.show()
PS2_KunduSixth8.13(1)PlotReIm