Solving 1-D Schrodinger Equation in Python (Scipy) Numerically

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 3K views
corychu
Messages
2
Reaction score
7
I've tried to make an animation using python to demonstrate the 1-D simple harmonic oscillator and step potential examples. Hope that it can be useful for some of you. Have fun~ :)
https://blog.gwlab.page/solving-1-d-Schrödinger-equation-in-python-dcb3518ce454

sho.gif


By the way, If you are interested, I also implemented a C++ version using RK4 and finite-difference scheme with Eigen library:
https://github.com/c0rychu/SchrodingerEq_1D_tutorial/tree/master/step_potential_cpp
 
Last edited:
Reply
  • Like
Likes   Reactions: Paul Colby, bob012345, Wrichik Basu and 2 others
on Phys.org
corychu said:
I've tried to make an animation using python to demonstrate the 1-D simple harmonic oscillator and step potential examples. Hope that it can be useful for some of you. Have fun~ :)
https://blog.gwlab.page/solving-1-d-Schrödinger-equation-in-python-dcb3518ce454

View attachment 284770

By the way, If you are interested, I also implemented a C++ version using RK4 and finite-difference scheme with Eigen library:
https://github.com/c0rychu/SchrodingerEq_1D_tutorial/tree/master/step_potential_cpp
I looked at your link but it's not completely clear (to me but it probably is to others :smile: ) what you are showing here. How did you construct this wave packet? Are the spikes at the classical boundaries? How does this simulation relate to cases G and H of the Wikipedia simulations? Thanks.

https://en.wikipedia.org/wiki/Quantum_harmonic_oscillator
 
bob012345 said:
I looked at your link but it's not completely clear (to me but it probably is to others :smile: ) what you are showing here. How did you construct this wave packet? Are the spikes at the classical boundaries? How does this simulation relate to cases G and H of the Wikipedia simulations? Thanks.

https://en.wikipedia.org/wiki/Quantum_harmonic_oscillator
Sorry for my late reply :(

I think the goal of the article is to tell you how to implement a lowest-order finite-difference method in Python and how to call the initial-value-problem solver in scipy.

As explained in the source code, my initial wave-pack is constructed by:

psi0 = A * np.exp(-(x-x0)**2 / (2.0 * sigma**2)) * np.exp(1j * kx * x)

So, I guess if you set kx=0, it will work like a particle resting at x0. In this case, it might be correct to think of it as a particle sitting at the classical boundary.

I'm not sure about the G shown in Wikipedia. But it said H is a coherence state.

If I understand correctly, a coherence state is a gaussian wavepacket with a specific width (sigma). So, if you are interested in that, you may set the sigma by the proper formula and run the code.

On the other hand, if the width (sigma) is an arbitrary value, I guess it is called a squeezed state. (Sorry that I'm really not good at quantum optics)
 
Reply
  • Like
Likes   Reactions: vanhees71 and bob012345