Conservation of probability issue when solving ODE in Mathematica

Click For Summary
SUMMARY

The discussion addresses a conservation of probability issue when solving a two-level Schrödinger equation using Mathematica. The user implements the equation with specific parameters, including W = 10, OmegaRabi = 1000, omega = 700000, and delta = 10000. The output, which represents the total probability |x(t)|² + |y(t)|², deviates from the expected constant value of 1 due to numerical errors. The user suggests adjusting the AccuracyGoal and PrecisionGoal settings in NDSolve to improve the results.

PREREQUISITES
  • Understanding of Schrödinger equations and quantum mechanics
  • Familiarity with Mathematica programming and syntax
  • Knowledge of numerical methods for solving ordinary differential equations (ODEs)
  • Concept of probability conservation in quantum systems
NEXT STEPS
  • Explore Mathematica's NDSolve documentation for advanced settings
  • Learn about adjusting AccuracyGoal and PrecisionGoal in numerical computations
  • Investigate methods to minimize numerical errors in ODE solutions
  • Study the implications of probability conservation in quantum mechanics
USEFUL FOR

Quantum physicists, computational scientists, and Mathematica users interested in solving Schrödinger equations and improving numerical accuracy in simulations.

kelly0303
Messages
573
Reaction score
33
I am trying to solve this two level (Schrödinger) equation as a function of time:$$i\begin{pmatrix}
\dot{x}\\
\dot{y}
\end{pmatrix} = \begin{pmatrix}
0 & iW+dE_0sin(\omega t)\\
-iW+dE_0sin(\omega t) & \Delta
\end{pmatrix}\begin{pmatrix}
x\\
y
\end{pmatrix}$$

(I can go into more details about the Hamiltonian if needed). The initial conditions are ##x(0)=1##, ##y(0)=0##. This is my Mathematica code for it:

W = 10;
OmegaRabi = 1000;
omega = 700000;
delta = 10000;
eqns = {I*x'[t] == (I*W + OmegaRabi*Sin[omega*t])*y[t],
I*y'[t] == (-I*W + OmegaRabi*Sin[omega*t])*x[t] + y[t]*delta,
x[0] == 1, y[0] == 0};
sol = NDSolve[eqns, {x, y}, {t, 0, 4}][[1]]
Plot[{Abs[x[t]]^2 + Abs[y[t]]^2 /. sol}, {t, 0, 1}]

All the variables are as in the original equation except for OmegaRabi which is equal to ##dE_0##. The output of this code (which would be the total probability i.e. ##|x(t)|^2+|y(t)^2|##) should be constant 1. However I get what is seen in the plot below. I assume this has to do with some rounding numerical errors (?). Is there a way to fix it and ideally have it deviate from 1 much slower as a function of time? I am interested in the ##|y(t)|^2## as a function of time, and if one looks at that, the values for it are around 0.00002, so currently the error after one second seems to be 5 times bigger than the value I am interested in.
 

Attachments

  • schrodinger.png
    schrodinger.png
    3.6 KB · Views: 157
Technology news on Phys.org
In NDSolve, you should modify AccuracyGoal and/or PrecisionGoal to try and get better results.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
833
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
1K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
9
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 23 ·
Replies
23
Views
2K
  • · Replies 6 ·
Replies
6
Views
1K