2
$\begingroup$

I tried something like that. Z is my hamiltonian

n = 5;

σ2 = 0.1;

RR = RandomReal[{-Sqrt[3*σ2], Sqrt[3*σ2]}, n];

Z = Table[
    KroneckerDelta[i - j + 1] + KroneckerDelta[i - j - 1], {i, 1, 
     n}, {j, 1, n}] + DiagonalMatrix[RR];

usol = NDSolveValue[{I D[ψ[x, t], t] == 
    Z.ψ[x, t], ψ[0, t] == 0, ψ[n, t] == 0}, ψ, {t,
    0, 1}]

I solve the problem finding the eigenstates and eigenvalues, then I choose a one site and evolve in time but now I want to solve the differential equation directly to check my results.

$\endgroup$
6
  • 2
    $\begingroup$ ψ is undefined.. $\endgroup$ Mar 2 at 0:26
  • 1
    $\begingroup$ You may want to take a look at @Carl Woll's recent answer 240255. $\endgroup$
    – Tim Laska
    Mar 2 at 2:44
  • $\begingroup$ Actually you do not provide initial conditions for ODE solver. $\endgroup$
    – yarchik
    Mar 2 at 9:04
  • $\begingroup$ @OkkesDulgerci ψ is an unknown function :) $\endgroup$
    – yarchik
    Mar 2 at 9:08
  • 1
    $\begingroup$ Your equation says nothing about the x dependence of the function. $\endgroup$ Mar 2 at 14:09
2
$\begingroup$

Assuming that $\psi$ is a normalized column vector of length $n$ that does not depend on "$x$", perhaps the OP is looking for something like this (following @Carl Woll's answers 210001 and 240255):

SeedRandom[1234];
n = 5;
tmax = 10;
σ2 = 0.1;
ψinit = Normalize@RandomReal[1, n];
RR = RandomReal[{-Sqrt[3*σ2], Sqrt[3*σ2]}, n];
Z = Table[
    KroneckerDelta[i - j + 1] + KroneckerDelta[i - j - 1], {i, 1, 
     n}, {j, 1, n}] + DiagonalMatrix[RR];
Clear[ψ]
usol = NDSolveValue[{I D[ψ[t], t] == 
     Z . ψ[t], ψ[0] == ψinit}, ψ, {t, 0, tmax}];
Plot[Abs[usol[t]], {t, 0, tmax}]
Plot[Abs[Total@usol[t]], {t, 0, tmax}]
Manipulate[
 ReImPlot[usol[t][[i]], {t, 0, tmax}, PlotTheme -> "Web", 
  PlotLabel -> i], {i, 1, n, 1}]

psi evolution plots

$\endgroup$
2
  • $\begingroup$ Thanks @TimLaska is too helpful $\endgroup$ Mar 2 at 21:01
  • $\begingroup$ You are welcome! Thank you for the Accept. $\endgroup$
    – Tim Laska
    Mar 2 at 21:20

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.