# Contour Plot of planetary motion in Mathematica

I was trying to make the contour plot on $(v,r)$ axis for planetary motion for different orbits to check for bounded and unbounded motion. This is what I tried

ContourPlot[0.5
Derivative[r][t]^2 - 0.2/r[t] + 0.6/r[t]^2 == k, {k, -10,10},
{Derivative[r][t], 0, 100}, {r[t], -5, 5}]


This is what I get as an error

Options expected (instead of {r[t],-5,5}) beyond position 3

I can't figure out what's wrong with that.

• Welcome to Mathematica SE! Please, compare your code the examples of ContourPlot in the documenation. The thrid arguments needs to be a range specification similar to the second. The equation in the first argument needs to be solved, and depend only on k and t. – Johu Sep 4 '18 at 17:44
• @Johu I looked on ContourPlot documentation. I could not find a Contour example of a function and its derivative. r[t] and r'[t] in my case. Or should I explicitly write equations of r[t] and r'[t] and solve them ? – aargiee Sep 4 '18 at 17:50
• Yes, you have to solve the equation before. Look up DSolve. – Johu Sep 4 '18 at 18:03
• @Johu Actually I managed to get it. I changed $r'[t]$ to $v[t]$ and removed k and addded an extra argument in the end {Contours -> 10} and voila I got it. Thanks – aargiee Sep 4 '18 at 18:06
• Yes, You are right. This works, because the plotted function is then only a function of $v$ and $r$. Consider answering your own qustion with the solution you found, such that others could later learn from you. – Johu Sep 4 '18 at 18:10

ContourPlot[0.5 v[t]^2 - 2/r[t] + 6/r[t]^2,
{r[t], 0, 100},
{v[t], -0.5, 0.5},
Contours -> 10, ContourShading -> None, ContourLabels -> All
] This gives 10 Contours There is no Shading to distinguish them because I want it like that and I have labeled the Contours too for easier identification.

• I hope you do not mind, that I edited the code for the readability, replaced none with None and added the output figure. Keep it up learning Mathematica! – Johu Sep 4 '18 at 18:28
• No not at all. I was infact trying to add an image but didn't want to take a screenshot of it – aargiee Sep 4 '18 at 18:29
• They are very easy to import. I select the figure in the notebook, click shortcut keys for edit->copy as->bitmap and paste it into import figure dialog box of the form. – Johu Sep 4 '18 at 18:31
• Alright. I'll do that next time – aargiee Sep 4 '18 at 18:32