| Author |
Comment/Response |
Christoph
|
03/26/04 05:37am
1. I want to calculate the first 2 Eigenvalues of a Hamiltonian H and plot them (or rather their absolute values as the numerical solution might create small imaginary parts).
2. Afterwards I add the Eigenvalue of the ground state to another part of the Hamiltonian (afore neglected) in order to solve the Hamiltonian equations numerically.
My program text:
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 = 5
H[q[t]] = Table[f[i, j, q[t]], {i, m}, {j, m}];
MatrixForm[%];
EC = 1
EJ = 0.1*EC
EV1[q[t]] = Eigenvalues[H[q[t]]][[1]];
EV2[q[t]] = Eigenvalues[H[q[t]]][[2]];
Plot[{Abs[EV1[q[t]]], Abs[EV2[q[t]]]}, {q[t], -0.5, 1.5}]
H2[q[t], \[Theta][t]] :=
EV1[q[t]] - 2*e*q[t]*u + 0.5/l*(0.5*hbar/e)^2*\[Theta][t]^2
hbar = e = u = l = 1;
solution =
NDSolve[{hbar*\[Theta]'[t] == -D[H2[q[t], \[Theta][t]], q[t]],
hbar*q'[t] == D[H2[q[t], \[Theta][t]], \[Theta][t]],
q[0] == 1, \[Theta][0] == 1}, {q[t], \[Theta][t]}, {t, 0, 20}];
Plot[Evaluate[\[Theta][t] /. solution], {t, 0, 20}];
I have the following problems:
1. up to a matrix size of 4 everthing works fine, but when I try to plot the Eigenvalues for m>4, I get a bunch of errors like:
-...
-Function::flpar : Parameter specification {q[t]} in Function[{q[t]},Abs[EV1[q[t]]]] should be a symbol or a list of symbols.
-...
-Plot::plnr : Abs[EV1[q[t]]] is not a machine-size real number at q[t]=-0.5
-...
2. When I call the NDSolve command for m=4 it gives me no errors but nevertheless when I try to plot the solution afterwards, it only plots parts of the graph and I get errors like:
Plot::plnr : InterpolatingFunction[{{0.,20.}},<>][t] is not a machine-size real number at t = 1.-961759971874737'. and so on...
I'd be very glad if anyone could help me!
Thanks in advance
Christoph
URL: , |
|