# 1D Time-Indep Sch Equation Solutions

1. Nov 27, 2005

### Hermite

1D Time-Indep Sch Equation Solutions....

I'm trying to write a C++ program which displays a 'moveable' graph showing the solution (wavefunctions) to the Schrodinger Equation for a Simple Harmonic Oscillator. I need a little help with the physics of it.
The idea is that (using the mouse) the graph can be slid up and down to be at different energy levels. When the graph is at an energy level corresponding to a non-integer quantum number (which of course doesn't really exist) then the user will see the wavefunction behaving badly - going up to infinity. But, when the graph is at an energy level corresponding to integer quantum numbers then the wavefunction behaves properly.

I've worked through Appenix I of Eisberg & Resnick's textbook and 'understand' how to get general solutions involving Hermite polynomials which can be plotted very nicely. But I don't know how to display the solutions where n (the quantum number) is a non-integer. Obviously what happens is the series cannot be made to terminate and so the wavefunction goes to infinity but I can't plot an infinite sum of terms.

So, my question is: how do I plot the wavefunction as a function of x for continuous n (i.e. for any value of n)? Perhaps you know of some other approach - I'd appreciate any help.

Thanks

2. Nov 27, 2005

### Dr Transport

can't do it. the solutions are for integer n only.

3. Nov 27, 2005

### Hermite

Ok, so it can't be done for the power series solution but are there are methods that will make it possible? What about numerical solutions?

4. Nov 27, 2005

### Physics Monkey

To say you can't do it isn't exactly accurate. The solutions you obtain are not normalizable, but they have a perfectly well defined power series expansion. In particular, unless the series terminates the terms in the power series tend towards the terms defining the series for $$e^{x^2}$$ (in normalized units). The trouble with such a solution is that it has two arbitrary constants which you must somehow determine. In the usual case, the boundary condition at infinity and the normalization condition suffice to give you the two constants. In the case of non-integer n, there are no boundary conditions that you can apply. Unless you just pick these two constants arbitrarily (as long as they both aren't zero the solution will explode), I don't see a way to do what you suggest.

5. Nov 27, 2005

### Hermite

I understand that the series solution presents difficulties but I've seen a program like this before so I know it's possible to make one.

The only question is how do I model the physics to allow the computer program to do what i want? Is there another approach?

6. Nov 27, 2005

### Physics Monkey

There is no "physics" for non-integer n, the solutions aren't physical. You might just use the power series method and pick the two constants arbitrarily (say 1 and 1). When the user picks a correct energy, the wavefunction will look all nice and decay to zero. When they don't, they will see something growing exponentially.

7. Nov 27, 2005

### Gokul43201

Staff Emeritus
I don't see the point of this. Is this an assignment for school ?

Last edited: Nov 27, 2005
8. Nov 27, 2005

### Staff: Mentor

Does it have to be the simple harmonic oscillator? If you use the finite square well instead, you can easily get general closed-form solutions for any energy, one for even-parity states and one for odd-parity states. They shoot off towards infinity outside the well except when the energy equals one of the energy eigenvalues. Somewhere on my computer at the office I have an Excel spreadsheet that shows a graph of the wave function for any energy you specify. By tweaking the energy and watching the behavior of the graph, you can zero in on the energy eigenvalues, to within several significant figures.

9. Nov 28, 2005

### Hermite

I'm trying to make this program as part of my project for my C++ course at University. I didn't put this topic under the homework section because, as you can see, it's not exactly a text book question.

If I can't find a way to do this for the S.H.O. then I just might have to use the infinite square well which I agree would be much easier.

10. Nov 29, 2005

### JTatts

Hi, I've got a maple sheet that solves the Schrodinger equation numerically for any binding potential. It does this by an iterative process of throwing different energy values into the differential equation until the wavefunction behaves. However, the incorrect wave functions can be displayed in graphical form and so may be helpful to you.
I don't have much experience in C++ though so I won't be able to offer any help there.
If you want the sheet let me have your email and i'll send it to you. I tried uploading it but the maple file type is not supported unfortunately

11. Dec 9, 2005

### Hermite

I've discovered that the Runge-Kutta method can be used to solve the Schroedinger Equation (S.E.) numerically but I'm having a little trouble with it.
The Runge-Kutta method works only on first order differential equations but the S.E. is 2nd order. A way around this is to 'separate' the 2nd order equation into two coupled first order equations and then solve them simultaneously but I don't know how to do that - it's really hard.

12. Dec 9, 2005

### JTatts

The separation into two different equations is not difficult.

I'll do the time independent SE in 1D for simplicity:

(hbar^2/m)Psi"+(V(x)-E)Psi=0

Define new variable

=> Z=Psi'

Then:

(hbar^2/m)Z'+(V(x)-E)Psi=0

Consequently you have two simultaneous 1st order equations that can be solved using RK method.

Standard boundary conditions for an S-Wave solution are:
Psi(0)=1, Z(0)=0

Obviously can be changed depending on problem.
Again I've got a maple sheet that does the whole RK method if you would like it.

13. Dec 9, 2005

### Hermite

Separating into the two first order equations isn't the problem. That's easy and I've done it. What I'm having a problem with is solving them simultaneously.
What's the new recursion relation? Do k1, k2 etc stay the same or are there new expressions for them?

It shouldn't be hard but whenever I find examples on the net, they're overcomplicated and try to achieve more than I need.

I sent you a PM asking for Maple but you never got back to me.

14. Dec 9, 2005

### JTatts

For basic RK method (not very efficient):

f1(Z) = Z
f2(Psi,x) = (E-V(x))*Psi

ka1 = h*f1(Zn)
kb1 = h*f2(Psin, xn)

ka2 = h*f1(Zn+0.5*ka1)
kb2 = h*f2(Psin+0.5*kb1, xn+0.5*h)

ka3 = h*f1(Zn+0.5*ka2)
kb3 = h*f2(Psin+0.5*kb2, xn+0.5*h)

ka4 = h*f1(Zn+ka3)
kb4 = h*f2(Psin+kb3, xn+h)

Psin = Psin + (1/6)*(ka1+2*ka2+2*ka3+ka4)
Zn = Zn + (1/6)*(kb1+2*kb2+2*kb3+kb4)

Those are the identies that you will need.
I didn't get the PM but i'll try sending you something now.

15. Dec 10, 2005

### Hermite

That's great but as far as I can tell those identities will give me Psi as a function of Z but I need Psi as a function of x. So, how do I do the last part and get Psi as a function of x?

16. Dec 10, 2005

### Hermite

Never mind, I'm being obtuse. x is obviously incremented by h.

I'll give it a go and see how it works out, thanks.

17. Dec 10, 2005

### Hermite

*Started repeating myself here*

Last edited: Dec 10, 2005
18. Dec 10, 2005

### robphy

19. Dec 10, 2005

### Hermite

Those applets are interesting but they don't help me with my problem.

I still can't get the runge-kutta method to work.

Can anyone give me a slightly more detailed explanation of how to use the given identities for two couple first order differential equations? Or perhaps point me to a website that will take me through step by step?

Thanks.