I have the force $F$ shown above. How could I specify the initial values of position ($x$) and speed ($v$) in Mathematica using the Manipulate command to try finding the initial values so the particle could move on a parabolic trajectory ($\alpha$) and a eight-shaped trajectory ($\beta$) ?

The initial values are not exact, just one solution each is enough.

Unfortunately I have no idea how to realize this problem, would be thankful for help!


Here is an interactive Manipulate using ParametricNDSolveValue to solve the differential equation; you can interact with it by dragging the locators to the desired sites and by adjusting the time horizon T by dragg the control bar at the top:

F[{x_, y_}] := {x, 4 y};
traj = ParametricNDSolveValue[
    Y''[t] == -F[Y[t]],
    Y[0] == {x0, y0},
    Y'[0] == {v0, w0}
   {t, 0, T},
   {x0, y0, v0, w0, T}

  Graphics[Arrow[{X[[1]], X[[2]]}]],
   traj[X[[1, 1]], X[[1, 2]], X[[2, 1]] - X[[1, 1]], X[[2, 2]] - X[[1, 2]], T][t], 
   {t, 0, T}
  PlotRange -> {{-1, 1}, {-1, 1}} 2
 {{X, {{1, 0}, {1, 1}}}, Locator},
 {{T, 5}, 0, 10}
  • $\begingroup$ looks amazing! thank you very much! $\endgroup$ – Tom Jan 6 '19 at 16:50
  • $\begingroup$ You're welcome. Have fun! $\endgroup$ – Henrik Schumacher Jan 6 '19 at 16:51
  • $\begingroup$ @Tom Btw.: Don't forget to upvote answers that you found helpful... That's what drives the community. $\endgroup$ – Henrik Schumacher Jan 6 '19 at 16:54
  • 1
    $\begingroup$ @Tom Just in case that you wonder: You can accept only one answer per question. ;) And I can live with it if you choose David's one... $\endgroup$ – Henrik Schumacher Jan 6 '19 at 16:58
  • 1
    $\begingroup$ @Tom: you can upvote both answers, but you can only accept one. $\endgroup$ – J. M. is in limbo Jan 6 '19 at 16:59


x[t] /. DSolve[ x''[t] == - w^2 x[t], x[t], t]

y[t] /. DSolve[ y''[t] == - w^2 4 y[t], y[t], t]

to find $x(t) = \cos (\omega t) + \sin (\omega t)$ and $y(t) = \cos (2 \omega t) + \sin (2 \omega t)$, with arbitrary constants that depend upon the initial conditions. Then plot:

w = 1;
ParametricPlot[{Cos[w t] + Sin[w t], Cos[ 2 w t] + Sin[2 w t]}, {t, 0,

enter image description here

  • $\begingroup$ thank you very much David! $\endgroup$ – Tom Jan 6 '19 at 16:51
  • $\begingroup$ Note that you can also include x[0] == x0, y[0] == y0 etc. in the list of equations sent to DSolve. This will yield a functional form for the solution that explicitly contains the initial conditions. $\endgroup$ – Michael Seifert Jan 6 '19 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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