I'm trying to simulate a particle in an electric and magnetic fields, but numerically instead of analytically. This is basically solving the equation
$$q \cdot \left(p'\times B\right) + q\cdot E = m p'',$$
where $p(t)$ is the position in $(x,y,z)$ coordinates.
After viewing a few topics on this site, I've got a good idea on how to get the solution using NDSolve
, but my program gets stuck, and doesn't come up with anything.
b = {1, 0, 0};
e = {0, 0, 1};
q = 1;
m = 1;
sol = NDSolve[ {q*e + q*Cross[D[pos[t], t], b] == m D[pos[t], {t, 2}],
pos[0] == {0, 0, 0}, (D[pos[t], t] /. t -> 0) == {0, 0, 0}},
pos, {t, 0, 1}];
ParametricPlot3D[Evaluate[pos[t] /. sol], {t, 0, 1}];
It is also worth mentioning that if you remove the $q\cdot E$ term, the calculation is finished, but nothing shows up in the plot.
pos
is the position, is your initial acceleration zero? $\endgroup$