1
$\begingroup$

I'm trying to implement the von Neumann Equation for a given 4x4 density Matrix with a time dependent Hamiltonian Hp[t_] in Mathematica but I get stuck.

Format[y[a__]] := Subscript[y, a]
rho[t_] := Array[x[##][t] &, {4, 4}]

sol = NDSolve[{I*rho'[t] == Hp[t].rho[t] - rho[t].Hp[t], 
   rho[0] == rhoIni}, {rho}, {t, 0, 10}]

However I only get the output

{{rho -> rho}}

So I guess something is structurally wrong with my code. I try to extract a solution by writing

rho[t_] = rho[t] /. sol

My Initial Condition is

{{0.261068, 0.190226, 0.148085, -0.190226}, {0.190226, 0.238932, 
  0.190226, -0.141687}, {0.148085, 0.190226, 
  0.261068, -0.190226}, {-0.190226, -0.141687, -0.190226, 0.238932}}

And the Hamiltonian is defined by:

Hp[t_] = {{1 + 0.1*Sin[t], -1, 0, 1}, {-1, 0, -1, 0}, {0, -1, 
   1 - 0.1*Sin[t], 1}, {1, 0, 1, 0}}

But this doesn't work as there is no solution anyways. Maybe you can help me

Thanks in advance

$\endgroup$
7
  • 1
    $\begingroup$ You should avoid using single Capital letters in your variable definitions because capital letters may intervene Mathematica Built-in functions. For example, I which you use may cause problems. What is I? $\endgroup$ – Tugrul Temel Feb 18 at 18:18
  • 2
    $\begingroup$ Please define the Hamiltonian Hp[t] and the initial conditions. $\endgroup$ – Daniel Huber Feb 18 at 19:30
  • $\begingroup$ @TugrulTemel The I is the symbol for the imaginary number in Mathematica $\endgroup$ – Interestedbutnotknowing Feb 18 at 21:18
  • $\begingroup$ @DanielHuber I added the Hamiltonian and the inital conditions $\endgroup$ – Interestedbutnotknowing Feb 18 at 21:18
  • 1
    $\begingroup$ There's a simple mistake in your NDSolve setup: solve for rho[t] instead of {rho}. Like this: NDSolve[{I*rho'[t] == Hp[t] . rho[t] - rho[t] . Hp[t], rho[0] == rhoIni}, rho[t], {t, 0, 10}] $\endgroup$ – Roman Feb 18 at 22:00
4
$\begingroup$

Don't define rho as an explicit matrix:

Hp[t_]={{1+0.1*Sin[t],-1,0,1},{-1,0,-1,0},{0,-1,1-0.1*Sin[t],1},{1,0,1,0}};
rhoIni={
    {0.261068,0.190226,0.148085,-0.190226},
    {0.190226,0.238932,0.190226,-0.141687},
    {0.148085,0.190226,0.261068,-0.190226},
    {-0.190226,-0.141687,-0.190226,0.238932}
};

Clear[rho]
sol = NDSolveValue[
    {I*rho'[t] == Hp[t].rho[t]-rho[t].Hp[t], rho[0]==rhoIni},
    rho,
    {t,0,10}
];

Visualization:

Plot[Abs[sol[x]],{x,0,10}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.