Skip to main content
2 of 2
added 383 characters in body
Sjoerd C. de Vries
  • 66.2k
  • 15
  • 189
  • 327

The main problem is that your pos is not seen as a 3D vector.

The cross product is therefore interpreted as a scalar:

q*Cross[D[pos[t], t], b]

Mathematica graphics

when adding this to the vector q.e this 'scalar' term is added to each of the vector components:

q*e + q*Cross[D[pos[t], t], b]

Mathematica graphics

This won't work, instead do:

b = {1, 0, 0};
e = {0, 0, 1};
q = 1;
m = 1;

Define pos as a 3D vector. Also take more time than a single second:

ClearAll[pos]
pos[t_] = {px[t], py[t], pz[t]};
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], {t, 0, 20}]

ParametricPlot3D[Evaluate[pos[t] /. sol], {t, 0, 20}]

Mathematica graphics

Sjoerd C. de Vries
  • 66.2k
  • 15
  • 189
  • 327