# Tutorial 12. Interactive -- Particle in a box in 1D

### Learning objectives

- Try the interactive python code to plot the 1D particle in a box wave function.
- Observe the change of the wave function with different box lengths and quantum numbers.

## Background

1D particle in a box problem is almost always the first model system discussed in quantum chemistry courses. We want to solve the time-independent Schrödinger equation

\[\hat{H}\psi = E\psi\]for a 1-D particle. The particle moves in 1D, with a potential that models the walls of a box must not allow the particle to get out of the range $0\le x\le L$.

\[V(x) = \begin{cases} \infty & x<0 \textrm{ or } x>L\\ 0 & 0 \le x \le L \end{cases}\]### Solution

The solution of 1D particle in a box: \(\psi(x)= \begin{cases} 0 & x<0 \textrm{ or } x>L\\ \psi_n(x) = \sqrt{2/L}\textrm{sin}(\frac{n\pi x}{L}), \ \ n=1,2,3\dots & 0 \le x \le L \end{cases}\)

## Try and learn

Run the following code to see how the wave function shape changes with the quantum number $n$ and box length $L$ (both can be tuned interactively).

Instruction:

- First, click “Activate” to activate the code block.
- Once you see the buttons to “run” at the bottom left corner of the code block, click “run” to run the code.
- Please be patient. Starting the kernel can be slow sometimes.
- You will see a plot with two panels. Upper is $\psi$; lower is $\vert\psi\vert ^2$.
- Play with the slider to select the quantum number you want. $n$ can be any positive integer. In this demo, we allow $n$ up to 100.
- Enter the wanted box length (in atomic unit bohr) in the text box. In this demo, we allow $L$ to be any float number between 0.1 and 100 just for demonstration purposes. Theoretically, $L$ can be any positive number.

## Question

- The wavefunction is zero at certain points; these points are called nodes. How does the number of nodes change with $n$?
- Where is the maximum of the probability distribution when $n=1$?
- Where are the maxima of the probability distribution when $n$ takes large numbers, say 100? How does that relate to the result of classical mechanics?

Written on September 1, 2021