Solving 1D Wave Function Evolution with Quantum Simulation

In summary: I implemented it using COMPLEX() in python, and got the same results, but MUCH slower. So I put it back to what it was before, handling imaginary and real separately.
  • #1
Mephisto
93
0
I am looking for a way to evolve a wave function in one dimension. I tried searching already but couldn't find anything. Basically I have:

V[x] gives the potential at x
Psi0[x] gives initial conditions on wave function for each x

I would like to calculate Psi[t,x], the wave function at any time t given those two arrays. How could I go about doing this?
 
Technology news on Phys.org
  • #2
You'll need two arrays for Psi, for the real and imaginary parts. Omitting various constants, Schrodinger's equation is

[tex]i \partial_t \psi(x,t) = - \partial_x^2 \psi(x,t) + V(x) \psi(x,t)[/tex]

A simple way to implement time-evolution, if you don't need to be extremely precise, is to simply discretize Psi and V and rewrite Schrodinger's equation as a finite difference equation. You can approximate as follows:

[tex]\partial_t \psi(x,t) \approx \frac{\psi(x,t+\Delta t) - \psi(x,t)}{\Delta t}[/tex]

[tex]\partial_x^2 \psi(x,t) \approx \frac{\psi(x+\Delta x,t) - 2 \psi(x,t) + \psi(x - \Delta x,t)}{\Delta x^2}[/tex]

You'll have to take some care at the endpoints (x min and x max) to keep errors from propagating due to the finite length of your Psi array. That is, you need some way of assuming what the value of Psi is beyond the limits of the array, so that you can take accurate finite differences.

Once you figure that out, merely plug these approximations into Schrodinger's equation, and you'll get an algebraic equation that you can solve for [itex]\psi(x, t+\Delta t)[/itex] in terms of your Psi array at the current instant of time.

Note: If you want to, you can even include a time-varying potential! Then you can simulate, for example, what happens to a particle in a potential when it is hit by a pulse of light. Have fun!
 
  • #3
Thank you very much for that. Surprisingly, it is really hard to find anything about this on the internet!

I implemented the difference equations, and it looks like it could have worked. I don't actually know, because my solution almost always "blows up". I set up potential V=0 with a gaussian distribution initially in the Real part of Psi, and let it evolve. It nicely diffuses, but then starts to oscillate wildly and spikes form inside it, and make it blow up. Its weird. Maybe I got the equations wrong? Or the boundary conditions? Everywhere outside my range I set Psi=0...

Here is my code for the most crucial part. self.at returns real, imaginary parts of Psi at the passed parameter.
Code:
        dtdx = self.dt/(self.dx*self.dx)        
        for x in range(0, self.num):
            r1,i1 = self.at(x-1)
            r2,i2 = self.at(x)
            r3,i3 = self.at(x+1)
            
            newpsir[x] = r2 + dtdx*(-i3 + 2.0*i2 - i1) + i2*self.v[x]*self.dt
            newpsii[x] = i2 + dtdx*(r3 - 2.0*r2 + r1) - r2*self.v[x]*self.dt

Maybe I could try re-normalizing my Psi after every update or something? hmm
 
Last edited:
  • #4
I am too sleepy to take a close look, but can I point out you can simplify by using Python's built in complex number type?

Code:
>>> x = 1 + 2j
>>> x**2
(-3+4j)

On another unsolicited note, Paul Falstad wrote some (much more sophisticated) Java applets on variations of this, and they are open source! For instance, he has 1D quantum mechanics applets (both wells, and periodic boundary conditions ("quantum crystal")), and 1D quantum mechanics with time-varying potentials ("quantum transitions"), as well as many 2D and 3D versions:

http://www.falstad.com/mathphysics.html

qm1drad.gif
 
Last edited:
  • #5
thank you for the suggestion signerror!
I implemented it using COMPLEX() in python, and got the same results, but MUCH slower. So I put it back to what it was before, handling imaginary and real separately. So that means the math is right, and its just that my timestep is too large, or the approximation not good enough or something? :(
 
  • #6
It shouldn't be - there's nothing wrong with the complex type, it's just a struct {double real; double imag}. I just tired a simple example benchmark (square a million complex numbers), and the complex-type version was fully TWICE as fast - user 1.476s, vs 2.930s (uncompiled).

What is COMPLEX()? Is that a class constructor or function? Don't do that - function calls are hugely inefficient (unless they're compiled inline functions, which aren't technically functions anyway). Use complex literals: x = 2+3j, y = x*z, and so forth.
 
Last edited:

1. What is quantum simulation?

Quantum simulation is a computational technique used to study and simulate quantum systems, such as atoms, molecules, and materials, that are too complex to analyze using traditional methods. It involves using classical computers to mimic the behavior of quantum systems and provide insights into their properties and behaviors.

2. How does quantum simulation help with solving 1D wave function evolution?

Quantum simulation allows scientists to accurately model the behavior of quantum systems, such as the evolution of wave functions, which can be difficult or impossible to study experimentally. By simulating the behavior of these systems, scientists can better understand their dynamics and make predictions about their behavior in different conditions.

3. What are the benefits of using quantum simulation for solving 1D wave function evolution?

Quantum simulation offers several advantages for solving 1D wave function evolution. It allows for the study of complex systems that are difficult to analyze using traditional methods, provides a more accurate representation of quantum behavior, and can be used to make predictions about the behavior of quantum systems in different conditions.

4. What types of quantum systems can be studied using quantum simulation to solve 1D wave function evolution?

Quantum simulation can be used to study a wide range of quantum systems, including atoms, molecules, and materials. It can also be applied to various physical phenomena, such as quantum phase transitions and quantum entanglement. In the context of solving 1D wave function evolution, quantum simulation can be used to study the dynamics of particles in 1-dimensional systems, such as quantum wires or quantum dots.

5. How does quantum simulation compare to other methods for solving 1D wave function evolution?

Quantum simulation is a relatively new approach for studying quantum systems, and it is still being developed and refined. It offers several advantages over traditional methods, such as the ability to study complex systems and make predictions about their behavior, but it also has its limitations. Other methods, such as analytical and numerical approaches, may still be more suitable for certain types of systems or problems.

Similar threads

  • Quantum Physics
Replies
24
Views
590
  • Programming and Computer Science
Replies
2
Views
1K
Replies
1
Views
484
  • Programming and Computer Science
Replies
1
Views
1K
Replies
9
Views
721
  • Programming and Computer Science
Replies
3
Views
2K
  • Programming and Computer Science
Replies
1
Views
3K
  • Quantum Interpretations and Foundations
Replies
13
Views
537
  • Advanced Physics Homework Help
Replies
10
Views
318
  • Programming and Computer Science
Replies
1
Views
895
Back
Top