Hi everyone, I'm trying to solve the Hamiltonian system to find the trajectory of an electron in a lattice. I've found the equations of my system but i can't solve the system. NDSOlve give me that error:
NDSolve::ntdvdae: Cannot solve to find an explicit formula for the derivatives. NDSolve will try solving the system as differential-algebraic equations. >>
NDSolve::index: The DAE solver failed at t = 0.`. The solver is intended for index 1 DAE systems and structural analysis indicates that the DAE index is 2. The option Method->{"IndexReduction"->Automatic} may be used to reduce the index of the system. >>
Trying with Method->{"IndexReduction"->Automatic} option it gives me:
NDSolve::ntdvdae: Cannot solve to find an explicit formula for the derivatives. NDSolve will try solving the system as differential-algebraic equations. >>
NDSolve::ndcf: Repeated convergence test failure at t == 0.`; unable to continue. >>
(I've not used the LegandreTransform function because this work is for academic purpose) Could someone help me please? Thank you in advance, here is my code:
L = 1/(2 m) (pxx[t]^2 + pyy[t]^2 + pzz[t]^2) - Uff[coordreticolo];
H[p_, q_, dq_] := Sum[p[[i]]*dq[[i]] - L, {i, Length[q]}];
H[{pxx[t], pyy[t], pzz[t]}, {x[t], y[t], z[t]}, {x'[t], y'[t], z'[t]}]
xp = D[H[{pxx[t], pyy[t], pzz[t]}, {x[t], y[t], z[t]}, {x'[t], y'[t],
z'[t]}], pxx[t]]
yp = D[H[{pxx[t], pyy[t], pzz[t]}, {x[t], y[t], z[t]}, {x'[t], y'[t],
z'[t]}], pyy[t]]
zp = D[H[{pxx[t], pyy[t], pzz[t]}, {x[t], y[t], z[t]}, {x'[t], y'[t],
z'[t]}], pzz[t]]
pxp = -D[H[{pxx[t], pyy[t], pzz[t]}, {x[t], y[t], z[t]}, {x'[t],
y'[t], z'[t]}], x[t]]
pyp = -D[H[{pxx[t], pyy[t], pzz[t]}, {x[t], y[t], z[t]}, {x'[t],
y'[t], z'[t]}], y[t]]
pzp = -D[H[{pxx[t], pyy[t], pzz[t]}, {x[t], y[t], z[t]}, {x'[t],
y'[t], z'[t]}], z[t]]
NDSolve[{x'[t] == xp, y'[t] == yp, z'[t] == zp, pxx'[t] == pxp,
pyy'[t] == pyp, pzz'[t] == pzp, x[0] == 0, pxx[0] == 0, y[0] == 0,
pyy[0] == 0, z[0] == 0, pzz[0] == 0}, {x[t], y[t], z[t], pxx[t],
pyy[t], pzz[t]}, {t, 0, 15},
Method -> {"IndexReduction" -> Automatic}]