Solving the Radial Function of the Hydrogen Atom with Python

Rhett Allain
9 min readNov 27, 2023
Not a real hydrogen atom — just a diagram.

The best thing in a quantum mechanics course is solving for the wave function of a hydrogen atom. It’s great because it’s possible to get an analytical solution to this problem in terms of some functions. For all the other atoms, we have to cheat or make some approximations. Historically, this is a big deal.

The worst thing in a quantum mechanics course is ALSO the hydrogen atom. Yes, it’s true that we can find a solution to the wave function — but we have to use spherical coordinates and things get messy.

Honestly, I think that in an undergraduate course the full solution is a little bit too much. However, it’s possible to get a differential equation for just the radial part of this function and then solve this equation using python and the shooting method.

The Hydrogen Atom

Let’s start with the hydrogen atom. It’s an electron interacting with a proton. Of course we need to write an expression for both the kinetic and potential energy — the potential energy would be the following.

Yes, I know that we normally use U for the potential energy — but for some reason, everyone use V in quantum mechanics. Whatever. Just a couple of things to point out. The two charges are +e and -e (for the proton and the electron). Also, I’m going to…

--

--

Rhett Allain

Physics faculty, science blogger of all things geek. Technical Consultant for CBS MacGyver and MythBusters. WIRED blogger.