Example
The Particle in a Box is a fundamental problem in quantum mechanics that describes a particle confined to a one-dimensional box with infinite potential walls.
The particle’s wavefunction and energy levels can be solved using the Schrödinger equation.
Problem Statement
Given a particle of mass $( m )$ confined in a $1D$ box of length $( L )$, calculate and visualize:
- The wavefunctions $( \psi_n(x) )$ for the first three quantum states $( n = 1, 2, 3 )$.
- The corresponding energy levels $( E_n )$.
Equations
Wavefunction:
$$
\psi_n(x) = \sqrt{\frac{2}{L}} \sin\left(\frac{n \pi x}{L}\right)
$$- $( n )$: Quantum number $( n = 1, 2, 3, \ldots )$.
- $( x )$: Position within the box $( 0 \leq x \leq L $)$.
Energy Levels:
$$
E_n = \frac{n^2 h^2}{8 m L^2}
$$- $( h )$: Planck’s constant $( 6.626 \times 10^{-34} \text{Js} )$.
- $( m )$: Mass of the particle.
- $( L )$: Length of the box.
Parameters
- Box length: $( L = 1 , \text{nm} = 1 \times 10^{-9} \text{m} )$.
- Particle mass:$ ( m = 9.11 \times 10^{-31} \text{kg} )$ (mass of an electron).
- Planck’s constant: $( h = 6.626 \times 10^{-34} \text{Js} )$.
Python Code
1 | import numpy as np |
Code Explanation
Constants:
- $ L $, $ m $, and $ h $ are defined in $SI$ units.
Energy Calculation:
- The energy levels $ E_n $ are calculated for $( n = 1, 2, 3 )$ using the energy formula.
Wavefunction Calculation:
- Wavefunctions are computed for each $ n $ using the sinusoidal formula.
Visualization:
- The first graph shows the spatial wavefunctions $ \psi_n(x) $.
- The second graph represents the energy levels.
Graph Explanation
- Wavefunctions:
- The wavefunctions have $ n-1 $ nodes (zero crossings) for quantum state $ n $.
- They represent the probability amplitude of finding the particle at position $ x $.

- Energy Levels:
- Energy levels increase quadratically with $ n $, as $ E_n \propto n^2 $.

Results
- The particle has distinct wavefunctions and quantized energy levels.
- Higher quantum states have more complex wavefunctions with additional nodes.
- Energy levels grow rapidly, reflecting the confinement in a small space.









