When creating physics simulations, especially in the realm of quantum mechanics and classical wave phenomena, dealing with complex functions is a common necessity. Visualizing these complex functions effectively is crucial for understanding their behavior and properties.
This guide will cover two approaches for visualizing complex functions in one dimension:
Plotting Real and Imaginary Parts Separately: This method involves plotting the real part and the imaginary part of the complex function as separate curves on the same graph.
Hue and Magnitude Scheme: In this approach, the magnitude of the complex function is shaded below with a hue determined by the phase. This provides a comprehensive visual representation of both magnitude and phase.
For visualizing complex functions in two dimensions, we will use the hue scheme exclusively, as it is particularly effective in conveying the intricate details of complex functions across two spatial dimensions.
Let’s explore each method with examples and plots to illustrate these concepts.
Plotting in 1D
In physics simulations, especially in quantum mechanics, a wavepacket is a common entity used to represent localized particles. A wavepacket is essentially a localized wave that can be described by a Gaussian function modulated by a complex exponential. This combines both position and momentum information, making it an ideal representation for quantum states.
Here, we create a wavepacket using the following steps:
Gaussian Shape: We start with a Gaussian function centered at x_0 with a standard deviation \sigma. This represents the spatial localization of the wavepacket.
Wave Component: We modulate this Gaussian by a complex exponential term e^{-i p x / \hbar}, where p is the momentum and \hbar is the reduced Planck’s constant. This adds the momentum component to the wavepacket.
Normalization: Finally, we normalize the wavepacket to ensure it has a unit probability when integrated over all space.
To visualize the complex wavepacket, we use three different methods:
Probability Density: This method involve plotting the probability density. This show the probability to find the particles when making measurements.
Plotting Real and Imaginary Parts Separately: This method involves plotting the real part and the imaginary part of the wavepacket separately on the same graph. This helps in understanding the individual contributions of the real and imaginary components.
Hue and Magnitude Scheme: This method uses color to represent the phase of the complex wavepacket and shading to represent the magnitude. The phase is mapped to a hue, while the magnitude determines the brightness, providing a comprehensive view of both aspects of the wavepacket.
To illustrate the concepts, let’s look at some specific examples of wavepackets:
Probability Density: Shows how the probability of finding a particle varies with position.
Zero Momentum Wavefunction: The phase is constant, resulting in a uniform color, and the wavefunction equals its real part.
Non-Zero Momentum Wavefunction: The phase varies, resulting in a striped hue pattern, and both real and imaginary parts are present due to the phase introduced by momentum.
In quantum mechanics, the probability density of finding a particle at a given position is given by the squared magnitude of the wavefunction, |\psi|^2. This example plot the probability density of a wavepacket.
In this case, the wavepacket has no momentum, meaning the wavefunction is purely real and the imaginary part is zero. This results in the wavefunction being equal to its real part.
Here, the wavepacket has a non-zero momentum. The wavefunction now has both real and imaginary parts due to the phase introduced by the momentum.
To further illustrate the behavior of wavepackets, we will visualize the phase. The phase of the wavepacket is represented by different colors (hues). For a wavepacket with zero momentum, the phase remains constant, resulting in a uniform color. When the momentum is zero, the phase of the wavepacket remains constant, resulting in a uniform hue.
For a wavepacket with non-zero momentum, the phase varies linearly with position, creating a striped hue pattern.
Plotting in 2D
Similar to the 1D case, a 2D wavepacket can be constructed by extending the Gaussian and wave components into two dimensions. The 2D wavepacket is represented by a Gaussian function in both x and y directions, modulated by complex exponentials representing the momentum components in both directions.
This code creates a 2D wavepacket with Gaussian spatial localization and complex exponential modulation to include momentum. The wavepacket is then normalized to ensure it has a unit probability when integrated over the entire 2D space.
To visualize the complex wavepacket in 2D, we use two different methods:
Probability Density: This method involves plotting the probability density. This shows the probability of finding the particles when making measurements.
Hue and Magnitude Scheme: This method uses color to represent the phase of the complex wavepacket and shading to represent the magnitude. The phase is mapped to a hue, while the magnitude determines the brightness.
Additionally, you can choose to plot in 2D or 3D.
It is possible to plot the probability density.
When the momentum is zero, the phase of the wavepacket remains constant. This results in a uniform hue across the entire wavepacket. The probability density will be a Gaussian distribution centered at the origin, and the hue will be consistent, reflecting the constant phase.
When the momentum is only in the x direction, the phase of the wavepacket varies along the x-axis but remains constant along the y-axis. This creates a pattern of stripes oriented parallel to the y-axis. Each stripe represents a region of constant phase. The probability density will still show a Gaussian distribution, but the hue will change periodically along the x-axis.
When the momentum is oriented with equal magnitude in both the x and y directions, the phase of the wavepacket varies equally along both axes. This results in stripes oriented at a 45-degree angle to the axes. The probability density remains Gaussian, but the hue will change periodically along a diagonal direction, reflecting the equal contributions of momentum in both x and y directions.