a potential that is finite between $0$ and $L$, and infinite everywhere else. The canonical example is an infinite potential well, i.e. In a typical problem, you are given a potential and all these conditions gives you constraints on the possible solutions. The wave function is also continuous and differentiable. The first one being that, as $|\Psi(x)|^2$ represents a probability distribution, as such it must sum to one. Now physically you have some constraints on your wave function.
Also as a result of that plotting the probability density over time is rarely interesting.The time-independent Schrödinger equation is The Tridiagonal Matrix Algorithm can only be used to solve ordinary differential equations, whereas if your potential depended on time you would have a partial differential equation and would need a different method to solve it. In these cases people quite typically just ignore the time component altogether.Īll this is to say that since your potential function doesn't depend on time then you aren't solving a time-dependent Schrodinger Equation. When you plot the magnitude of the probability that term just becomes 1 and so the probability doesn't change over time. The general solution in that case is just the solution to the time-independent Schrodinger Equation multiplied by exp(-iE/h_bar). In the Schrodinger Equation, if the potential function does not depend on time then the different equation is called separable because you can solve the time component and spatial component of the differential equation separately. You say you are solving a time-dependent system, but I don't see any time-dependence (even if lambda != 0). (Bear in mind that my computational physics course was ten years ago now) The black line is abs(psi), the red one is Im(psi) and the blue one is Re(psi). Ofstream file_psi_re, file_psi_imag, file_psi_abs, file_potential,įile_psi_re << fixed << setprecision(6) << PSI.real() << " " įile_psi_imag << fixed << setprecision(6) << PSI.imag()įile_psi_abs << fixed << setprecision(6) << abs(PSI) << " " Normalization of the wave function in the next time step Probability density of the wave function in the next time step PSI = psi // Assign values to the wave function Fill in the current time step vector d representing the rhs PSI = 0.0 // Boundary conditions for the wave functionĭ = 0.0 // Boundary conditions for the rhs PSI = PSI / sqrt(sum0) // Normalization of the initial Sum0 += abs(pow(PSI, 2)) // Needed for the normalization PSI = phi // Initial condition for the wave function Eigenfunction of the harmonic oscillator in the ground state X = (-nx / 2) + i // Values on the x axis We don't have the first member of the left diagonal and the last member First create the vectors to store the coefficients
This is the reverse sweep, used to update the solution vector This gives the value of the last equation in the system
Create the c_prime and d_prime coefficients in the forward sweepįor (int i = 1 i m = 1.0 / (b - a * c_prime) ĭ_prime = (d - a * d_prime) * m This updates the coefficients in the first row Algorithm for solving the tridiagonal matrix system
to test the code against the known solution for the harmonicĭouble r = delta_t / (delta_x * delta_x) //used to simplify expressions for #include Ĭonst int L = 1 //length of domain in x directionĬonst int nx = 100, nt = 100 //number of the grid points and time steps respectivelyĭouble lambda //dictates the shape of the potential (we can use lambda = 0.0 Here is my code and the animation for 100 time steps and 100 points on the grid.
So I understand that I need to have constant magnitude of the wave function over the time interval, but I don't know how to do it, or where am I doing mistake. Actually, I see that in one point it time it becomes constant, but before that is oscillating. I test the code against the known solution for the harmonic potential (I put lambda = 0), but the animation shows that abs(Psi) is changing with time, and I know that is not correct for the harmonic potential.
My code is working and I animate the results in Mathematica, to check what is going on. I wrote the code in C++ which solves the time-dependent 1D Schrodinger equation for the anharmonic potential V = x^2/2 + lambda*x^4, using Thomas algorithm.