Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to choose a right algorithm in stochastic.schroedinger() #291

Closed
PaulisBeetle opened this issue Jan 20, 2021 · 7 comments
Closed

How to choose a right algorithm in stochastic.schroedinger() #291

PaulisBeetle opened this issue Jan 20, 2021 · 7 comments

Comments

@PaulisBeetle
Copy link

PaulisBeetle commented Jan 20, 2021

Hi, I feel puzzled about the usage of stochastic.schroedinger in example "dephase of atom", where you use a different algorithm in the package StochasticDiffEq. I can't see why we need another algorithm here. The stochastic Hamiltonian in the example looks as same as the one in the section "Stochastic Schrödinger equation". I compare the results of two algorithms and find that the results of RKMil(:Stratonovich) are indeed better agreement with the results of master equation. So does the right algorithm should be RKMil(:Stratonovich)? Can you tell me how to choose the right one? Thanks!

@david-pl
Copy link
Member

Hi! It really depends on your problem. In the example where the atom dephases the stochastic Hamiltonian is taken in the Stratonovich sense (hence the :Stratonovich). Without more details on what you're trying to solve, I can't really tell you which algorithm you should choose. You may also want to have a look here: https://diffeq.sciml.ai/latest/solvers/sde_solve/ for a full list of methods.

@PaulisBeetle
Copy link
Author

Thanks for your reply @david-pl ! Well my purpose is to simulate a master equation using stochastic Schrödinger equation. The jump operators are still sigmax, sigmaz and sigmay or sum of them which are always Hermitian. To some extent, it is a "generalized dephase process". So it should also be taken in the Stratonovich sense as your example. But I don't know why Stratonovich is a better choice.
Besides, I also have tried to decompose the whole process into a number of slices. In your example, Hamiltonian consists of a random number generated from randn() times sigmaz() . But the results of this method are much worse than those of stochastic.schrodinger even though I choose the time slice as small as possible. Can you tell why this method fails ? How should I simulate the physical process? Thanks!

@david-pl
Copy link
Member

But I don't know why Stratonovich is a better choice.

As I said before, this really depends on your problem. If you have a master equation that can be mapped to a stochastic Hamiltonian where the noise is to be taken in the Stratonovich sense ("normal" calculus), then you can only use algorithms that work in the Stratonovich sense, otherwise you will get different results (Ito calculus works differently). Since you mentioned you get better agreement between the master equation and the Stratonovich stochastic Schrödinger equation, I assume that this is sort of a numerical proof that your master equation maps to a Stratonovich stochastic equation.

Besides, I also have tried to decompose the whole process into a number of slices.

I don't understand what you mean here. Did you try to discretize the integration using a fixed time step?

@PaulisBeetle
Copy link
Author

I assume that this is sort of a numerical proof that your master equation maps to a Stratonovich stochastic equation.

Thanks for your detailed explanation to my questions. I also note the following words in the example

One can show, that when transforming the Von-Neumann equation with the Hamiltonian Hs
into Ito form and averaging over the noise, that the system can be modelled by the Master equation

Does it mean that the corresponding master equation can be obtained from Ito calculus? Is there any conflict? It maybe a stupid question since I am not very familiar with stochastic equation.

I don't understand what you mean here. Did you try to discretize the integration using a fixed time step?
Yes. I use a fixed time step.

@david-pl
Copy link
Member

The master equation can be obtained by averaging the stochastic Von-Neumann equation over the noise. In principle, it does not matter whether you write the stochastic equation down in Ito or Stratonovich sense, the average should give the same result (the same master equation). The reason for transforming the equation to Ito is that the averaging is easier since the average over the density operator times the noise vanishes for a Markovian density operator. See Appendix A of this paper: https://arxiv.org/pdf/1605.00874.pdf

This means that the master equation can be obtained from either Ito or Stratonovich. The result is the same master equation, but the stochastic VN equation has a different form depending on whether it is written in Ito or Stratonovich. The averaging over the noise is tricky in the Stratonovich sense and the easiest way is really to transform to Ito, which is why I wrote that comment in the example.

Does it mean that the corresponding master equation can be obtained from Ito calculus? Is there any conflict? It maybe a stupid question since I am not very familiar with stochastic equation.

Just to sure I'm not adding into the confusion here, let me clarify once more: The master equation is the same, regardless of whether you write your stochastic Hamiltonian in the Ito or Stratonovich sense. However, depending on which you choose the stochastic Hamiltonian will be different. Therefore, once you specify your stochastic Hamiltonian you can only solve it with either in the Stratonovich sense or the Ito (depending on which form of the Hamiltonian you have). Otherwise you will get wrong results, that differ from the master equation results. In the example where an atom dephases, the Hamiltonian is written in the Stratonovich sense and thus is solve with RkMil{:Stratonovich}.

In principle I suppose that also means you could find an Ito form of the stochastic Hamiltonian. But if your Hamiltonian is the same as the one in the dephasing example, it is to be taken in the Stratonovich sense. Also, I actually don't know how that Hamiltonian would look when written in Ito calculus, and I'm not sure how you would go about finding that form.

@PaulisBeetle
Copy link
Author

PaulisBeetle commented Jan 20, 2021

Thanks for your comprehensive replies! It helps me a lot.

The last question is about the integration of stochastic equation using a fixed time step. The relative error increases quickly as time goes by. It should be caused by the first-order approximation. Thanks for your help again.

@david-pl
Copy link
Member

You're welcome.

The last question is about the integration of stochastic equation using a fixed time step. The relative error increases quickly as time goes by. It should be caused by the first-order approximation.

Okay so I guess you're basically using a Euler method to solve? The RKMil solver uses a first-order Milstein method and adaptive timesteps to improve accuracy, so it should perform better in terms of numerical error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants