# Four Ways to Solve the Schrödinger Equation for the 1D Infinite Square Well

--

Oh, you are taking quantum mechanics? That’s great. In just about every single version of this course, the students are going to find an expression for the wave function in an infinite 1 dimensional square well using Schrödinger equation. So, how do you solve this problem? Well, you are in luck. I’m going to solve this equation 4 different ways. I’ll start with the plain basic method used most textbooks. After that, I’m going to show you 3 ways to solve this with Python. It’s going to be great.

# Analytical Solution

What is a 1D infinite square well? Imagine that you have a particle that can only move in the x-direction. It is also confined to move between x = 0 and x = a by two infinite potential walls (this makes the “well”).

We can find the wave function for this situation using the 1D Schrödinger. It looks like this.

Don’t worry about where this comes from or what it means (that’s a whole other story), just know that it’s a differential equation and we want to find an expression for Ψ(x,t). Oh, what about the other stuff? Well, here’s a list:

- Time = t
- h-bar = a constant
- Mass of the particle = m
- Potential energy function = U(x)

One way to solve this is to assume that Ψ(x,t) is a product of a time function and a space function. We can write this as:

On top of that, inside our infinite well the potential is equal to zero (U(x) = 0). That means our equation becomes:

Since these are partial derivatives, the f comes out of the space derivative and the ψ (lower case) comes out the time derivative.

Now let’s divide both sides by fψ (it’s a trick).

This gives us something nice. On the left side of the equation we have a term THAT ONLY depends on time. On…