The solution to this system of differential equations:

    x''[t] == k[t] y'[t], y''[t] == -k[t] x'[t], 
    x'[0] == A, y'[0] == 0, x[0] == 0, y[0] == 0}, 
  {x, y}, {t, 0, 10}]

satisfies this equation:

x'[t]^2 + y'[t]^2 == A

But when NDSolve solves the system, the speed will eventually move away from it's initial value A.

Is there anyway to make NDSolve keep the speed normalized?

  • 1
    $\begingroup$ @ Coolwater: This can be easily done: eliminate y'[t] from x'[t]^2+y'[t]^2==A^2, i.e. y'[t] = +-Sqrt[A^2-x'[t]^2]. Then your only remaining equation will be {x''[t]==+-k[t] Sqrt[A^2-x'[t]^2],x'[0] == A, x[0] == 0}. After specifying k(t), A and the sign of the Sqrt you can NSolve it. $\endgroup$ Aug 21, 2014 at 7:14
  • $\begingroup$ I don't understand how that is useful. When the order of the equation system is reduced to 3, how would I know what the sign of the Sqrt is? It's needed for both y'[t] and x''[t], so only x'[t]and k[t] is available to determine it, which I believe is impossible?! $\endgroup$
    – Coolwater
    Aug 21, 2014 at 8:16
  • $\begingroup$ you should just NDSolve the equation for both signs and then look how they fit together. $\endgroup$ Aug 21, 2014 at 8:22
  • $\begingroup$ BTW the system describes the motion of a charged particle in the x-y-plane in a time-dependent magnetic field along the z-axis given by k(t). It leads to interesting trajectories. Take k(t) = t or k(t) = Sin(t/5) for instance. $\endgroup$ Aug 21, 2014 at 8:25

1 Answer 1


As it is (unspecified k[t], A) NDSolve will not work. However the equations can be handled analytically. After a simple manipulation you can decouple them and get :

rawx[t_] = x[t] /. DSolve[{k[t] x'''[t] - k'[t] x''[t] == -k[t]^3 x'[t]}, x[t], t]

rawy[t_] = y[t] /. First@DSolve[{D[#, {t, 2}]/k[t] == y'[t]}, y[t], t] & /@ rawx[t]

Now you can check that indeed :

rawx'[t]^2 + rawy'[t]^2 // Simplify
(* {-2 C[1], -2 C[1]} *)

A quicker way is to rename x'[t]->m[t], y'[t]->y[t] and then :

raw = DSolve[{m'[t] == k[t] n[t], n'[t] == -k[t] m[t]}, {m[t], n[t]}, t]
sol[t_] = {m[t], n[t]} /. First@raw

sol[t]^2 // Total // Simplify
(* C[1]^2 + C[2]^2 *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.