Wavefunction Visualization
This Python code visualizes a wave function (Ψ) for a particle and its probability density. The wave function describes the probability of finding the particle at a specific position (x) and time (t).
Features:
- Interactive plot using Plotly.
- Sliders to adjust wave number (k) and time (t).
- Real part of the wave function and probability density are displayed.
- Make sure you have the required libraries installed: numpy, plotly, ipywidgets. You can install them using pip install numpy plotly ipywidgets.
- Save the code in a Python file (e.g., wavefunction_visualization.py).
- Run the script from your terminal using python wavefunction_visualization.py.
Explanation:
- Wave number (k): Relates to the momentum of the particle.
- Time (t): Represents the specific time at which the wave function is visualized.
Mathematical Background:
The wave function is visualized using the following equation:
Ψ(x, t) = exp(1j * (k * x - t)) + exp(-1j * (k * x + t))
where:
- Ψ(x, t): Wave function at position (x) and time (t)
- k: Wave number (related to momentum)
- t: Time
- j: Imaginary unit
Further Customization:
You can modify the code to visualize the imaginary part of the wave function instead of the real part. The code can be extended to include additional features, such as animation to show wave function evolution over time.