"Shooting Method" for simulating a Particle in an Infinite Square Well

In summary, the conversation discusses the development of a program in Matlab to solve the Schrodinger Equation for a particle in an infinite square well using the Shooting Method. The code includes variables for the wave function, x steps, potential, and energy, as well as boundary conditions. However, when plotting the wave function, it does not match the expected result and the user is unsure where the error lies. They also mention a textbook by N. Giordano that they are using for reference.
  • #1
Bassa
46
1
Hello! I am trying to write a program that solves the Schrodinger Equation for a particle in an infinite square well. I did a lot of research regarding the methods that could be used to accomplish this. I am writing this program in Matlab. The method I am using is called the Shooting Method. In my code below, when I plot psi vs. x_negative, I do not get a wave function that looks like what we expect. I am not sure where I am going wrong with this. I also don't know how much details I should include in this thread. Please, ask me for more information if needed. I have also attached picture of the textbook I am using for my logic. It is from the Computational Physics textbook by N. Giordano. Thank you very much for your help!

Matlab:
clear;
clc;
%declaring variables
psi = zeros(1,200); %Wave function
dx = 0.01; %x steps
V = 1000; %potential outside the well
e = 3; %initial guess energy
de = -.6; %energy step-size.

%boundry conditions
psi(1) = 1;
psi(2) = 1;

last_diverge = 0; %keeping track of the curvature of the wave function
flag = 't'; %variable to control the while loop below

while flag == 't'
    %this for loop needs to be nested in another loop
    for k = 2:length(psi)-1
        %defining the potential funtion of the well
        if abs(k*dx) <= 1
            potential = 0;
        else
            potential = V;
        end
        psi(k+1) =  2*psi(k) - psi(k-1) - 2*(e - potential)*(dx^2)*psi(k);
        %if psi exceeds the maximum magnitude, then exit the loop
        if psi(k+1) > 2
            break;
        end
    end
   
    %plotting the left side of the wave function
    f = 1;
    for n = -k:0
        x_negative(f) = n*dx;
        f = f + 1;
    end
   
    %asking the user if they want to estimate more
    flag = input('Enter (t) if you would like to continue finding the solution: ','s');

    %updating the curvature of the wave function
    if psi(k+1) > 0
        diverge = 1;
    else
        diverge = -1;
    end
    if diverge * last_diverge < 0
        de = -(de/2);
    end
    e = e + de;
    last_diverge = diverge;
end
<Moderator's note: please use code tags>
 

Attachments

  • Screen Shot 2017-03-10 at 2.25.43 PM.png
    Screen Shot 2017-03-10 at 2.25.43 PM.png
    29.2 KB · Views: 709
Last edited by a moderator:
Technology news on Phys.org
  • #2
Bassa said:
In my code below, when I plot psi vs. x_negative, I do not get a wave function that looks like what we expect.
So what do you get?

One thing that bothers me is
Matlab:
psi(1) = 1;
psi(2) = 1;
This is not a valid slope for the wave function. You need to initialize the 2-point recursion with psi(1)≠psi(2).
 
  • Like
Likes aaroman

1. What is the Shooting Method for simulating a Particle in an Infinite Square Well?

The Shooting Method is a numerical technique used to solve for the wave function of a particle in an infinite square well potential. It involves breaking the differential equation for the wave function into two parts and solving them iteratively.

2. How does the Shooting Method work?

The Shooting Method involves choosing two initial values for the wave function at the boundaries of the well and solving two separate differential equations for the wave function using those values. The two solutions are then compared and adjusted until they converge to a single solution.

3. What is the advantage of using the Shooting Method over other methods?

The Shooting Method is advantageous because it does not require knowledge of the boundary conditions at both ends of the well, unlike other methods such as the Finite Difference Method. It also allows for the calculation of the wave function at any point within the well, not just at the boundaries.

4. What are the limitations of the Shooting Method?

The Shooting Method can be computationally intensive when solving for highly excited states of the particle in the well. It also assumes that the potential is constant within the well, which may not be the case in more complex systems.

5. How accurate is the Shooting Method in simulating a Particle in an Infinite Square Well?

The accuracy of the Shooting Method depends on the convergence of the two solutions for the wave function. As long as the solutions are adjusted until they converge, the method can provide accurate results. However, for highly excited states, the accuracy may be lower due to the computational limitations mentioned earlier.

Similar threads

  • Advanced Physics Homework Help
Replies
7
Views
1K
Replies
16
Views
562
Replies
1
Views
792
  • Quantum Physics
Replies
1
Views
644
  • Advanced Physics Homework Help
Replies
2
Views
1K
  • Advanced Physics Homework Help
Replies
2
Views
831
  • Advanced Physics Homework Help
Replies
4
Views
1K
  • Advanced Physics Homework Help
2
Replies
39
Views
9K
  • Quantum Physics
Replies
1
Views
750
  • Introductory Physics Homework Help
Replies
22
Views
1K
Back
Top