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

Click For Summary
SUMMARY

This discussion focuses on solving the 1-D Schrödinger Equation numerically using Python and SciPy, specifically for simulating a simple harmonic oscillator and step potential. The implementation utilizes a lowest-order finite-difference method, with the initial wave packet defined by the equation psi0 = A * np.exp(-(x-x0)**2 / (2.0 * sigma**2)) * np.exp(1j * kx * x). Additionally, a C++ version of the simulation is available, employing the RK4 method and the Eigen library. The conversation also touches on the relationship between the simulation and quantum coherence states.

PREREQUISITES
  • Familiarity with Python programming and SciPy library
  • Understanding of quantum mechanics concepts, particularly wave packets
  • Knowledge of numerical methods, specifically finite-difference methods
  • Basic understanding of C++ programming and the Eigen library
NEXT STEPS
  • Explore the implementation of the finite-difference method in Python for quantum simulations
  • Learn about the RK4 method for solving ordinary differential equations in C++
  • Investigate quantum coherence states and their mathematical representation
  • Review the Wikipedia simulations for quantum harmonic oscillators, specifically cases G and H
USEFUL FOR

Researchers, physicists, and developers interested in quantum mechanics simulations, particularly those utilizing Python and C++ for numerical methods.

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:
  • Like
Likes   Reactions: Paul Colby, bob012345, Wrichik Basu and 2 others
Technology news 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)
 
  • Like
Likes   Reactions: vanhees71 and bob012345

Similar threads

  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
8K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
Replies
3
Views
4K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K