| Author |
Comment/Response |
Christoph
|
03/26/04 10:31am
Now I try to work with pure functions for q and \[Theta]:
Clear[f, q, H, EJ, EC]
f[i_, j_, q_] :=
Which[i == j, EC*(q - i + 1)^2 , Abs[j - i] == 1, EJ/2, Abs[j - i] > 1,
0];
m = 8
H[q_] = Table[f[i, j, q], {i, m}, {j, m}];
MatrixForm[%];
EC = 1
EJ = 0.1*EC
EV1[q_] = Eigenvalues[H[q]][[1]];
EV2[q_] = Eigenvalues[H[q]][[2]];
Plot[{Re[EV1[q]], Re[EV2[q]]}, {q, 0, 7}]
H2[q_, \[Theta]_] := EV1[q] - 2*e*q*u + 0.5/l*(0.5*hbar/e)^2*\[Theta]^2
hbar = e = 1;
l = 1000; u = 0;
solution =
NDSolve[{hbar*\[Theta]'[t] == -D[H2[q, \[Theta]], q],
hbar*q'[t] == D[H2[q, \[Theta]], \[Theta]],
q[0] == 1, \[Theta][0] == 1}, {q, \[Theta]}, {t, 0, 20}];
Now the first plot works without problems even for m>7 (and I just don't get the difference, can someone explain?), but now the NDSolve doesn't work anymore. error:
NDSolve::ndnum : Encountered non-numerical value for a derivative at t == 1.4876206054'*^-313.
I don't get it. I hope someone can enlighten me...
Have a nice weekend,
Christoph
URL: , |
|