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

AI Thread Summary
The discussion centers around creating animations in Python to illustrate the 1-D simple harmonic oscillator and step potential examples, aimed at aiding understanding of these quantum mechanics concepts. The creator also shares a C++ implementation using the RK4 method and finite-difference scheme with the Eigen library. A participant seeks clarification on the construction of the wave packet used in the animation, questioning whether the spikes correspond to classical boundaries and how the simulation relates to specific cases in Wikipedia's quantum harmonic oscillator examples. The creator explains that the initial wave packet is constructed using a Gaussian function and that setting certain parameters can simulate different states, such as a resting particle or a coherent state. The discussion highlights the educational intent behind the animations and the technical details of the simulations.
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-schrodinger-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 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-schrodinger-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 vanhees71 and bob012345
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top