Conservation of probability issue when solving ODE in Mathematica

In summary: The code provided, with the given initial conditions and variable values, may have rounding numerical errors causing the output to deviate from the expected constant value of 1. Adjusting the AccuracyGoal and/or PrecisionGoal may help decrease this deviation and give more accurate results. Additionally, looking at the specific value of |y(t)|^2 as a function of time may also provide more insight into the issue at hand.
  • #1
kelly0303
561
33
I am trying to solve this two level (Schrodinger) 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: 72
Technology news on Phys.org
  • #2
In NDSolve, you should modify AccuracyGoal and/or PrecisionGoal to try and get better results.
 

1. What is the conservation of probability issue when solving ODE in Mathematica?

The conservation of probability issue refers to the fact that when solving ordinary differential equations (ODEs) in Mathematica, the total probability of all possible outcomes must remain constant. In other words, the sum of the probabilities of all possible solutions to the ODE must always equal 1.

2. Why is the conservation of probability important in ODE solving?

The conservation of probability is important because it ensures that the solutions to the ODE are physically meaningful and accurately represent the system being modeled. If the total probability is not conserved, it can lead to erroneous results and make the solutions invalid.

3. How does Mathematica handle the conservation of probability issue when solving ODEs?

Mathematica uses various numerical methods to solve ODEs, such as the Runge-Kutta method, which automatically conserves probability. However, it is important for the user to carefully select the appropriate method and parameters to ensure the conservation of probability.

4. Can the conservation of probability issue be a problem in ODE solving?

Yes, the conservation of probability issue can be a problem if the wrong method or parameters are chosen. In some cases, the solutions may not accurately represent the system being modeled, leading to incorrect conclusions or predictions.

5. How can I ensure the conservation of probability when solving ODEs in Mathematica?

To ensure the conservation of probability, it is important to carefully select the appropriate method and parameters for solving the ODE. It is also helpful to regularly check the total probability of all solutions to ensure it remains constant. If the issue persists, it may be necessary to use a different numerical method or adjust the parameters until the total probability is conserved.

Similar threads

  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
6
Views
303
  • Advanced Physics Homework Help
Replies
9
Views
875
  • Programming and Computer Science
Replies
15
Views
1K
Replies
5
Views
880
  • Introductory Physics Homework Help
Replies
8
Views
705
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
263
  • Calculus and Beyond Homework Help
Replies
2
Views
126
Back
Top