1
$\begingroup$

I have a differential equation for dr/dt and d[Theta]/dt in terms of r and theta, and I am trying to plot the trajectory in the x-y plane for a given initial condition (r,theta).

http://reference.wolfram.com/language/ref/StreamPlot.html

There is an example on this page for a set of differential equations already in cartesian coordinates, but I don't know what to do for polar.

$\endgroup$
3
  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – bbgodfrey May 11 '15 at 23:55
  • 3
    $\begingroup$ Please provide your equations in the question, so readers know what problem you are trying to solve. For instance, I would think you should use ParametricPlot, not StreamPlot. $\endgroup$ – bbgodfrey May 11 '15 at 23:57
  • $\begingroup$ duplicate for field: StreamPlot in Polar Coordinates, answer for single trajectory: graph in the Polar Plane. TransformedField may be of use. $\endgroup$ – Kuba May 12 '15 at 6:44
1
$\begingroup$

Define:

 polarToCartesian[r_,theta_]:=r*{Cos[theta],Sin[theta]}

Then, after you solve the differential equation, use ParametricPlot:

 ParametricPlot[polarToCartesian[r[t],theta[t]],{t,0,t0}]

UPDATE

polarToCartesian[{r_, theta_}] := r*{Cos[theta], Sin[theta]}

s = ParametricNDSolve[
      {r'[t] == r[t] (1 - (r[t])^2) (4 - (r[t])^2), 
       theta'[t] == 2 - (r[t])^2,
       r[0] == r0, theta[0] == theta0},
       {r, theta}, {t, 0, 10}, {r0, theta0}];


solution[r0_, theta0_, t_] := 
 Evaluate[{r[r0, theta0][t], theta[r0, theta0][t]} /. s]

Manipulate[
 ParametricPlot[polarToCartesian[solution[r0, theta0, t]], {t, 0, 10},
   PlotRange -> {-2.5, 2.5}]
   ,{r0, 0.01, 2}, {theta0, 0, 2 Pi}]

enter image description here

$\endgroup$
3
  • $\begingroup$ could you please try plotting my example? It seems to keep running and won't display anything for me, I think it's having trouble trying to solve the equations. My differential equations are r'[t] == r[t] (1 - (r[t])^2) (4 - (r[t])^2), [Theta]'[t] == 2 - (r[t])^2 $\endgroup$ – Kenny L May 12 '15 at 0:09
  • 1
    $\begingroup$ @KennyL You should add this important information to your question. $\endgroup$ – Michael E2 May 12 '15 at 0:31
  • $\begingroup$ @KennyL : Done! $\endgroup$ – Ivan May 12 '15 at 1:34

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