Message Boards Message Boards


Simulate and visualize a solar planet's motion?

Posted 7 months ago
4 Replies
0 Total Likes

I want to simulate Solar Planet's motion with mathematica, so I typed like this. The Code

But there were some errors.

I can't figure out what is wrong and how to fix it. The Error

4 Replies

Inside Graphics the object should be gathered within curly brackets: Graphics[{....}].

You did not put the curly braces. After the correction, we get the desired animation

G = 1; M = 1; \[Omega][r_] := Sqrt[G*M/r^3]; t0 = 4*Pi;
Animate[Graphics[{Red, Disk[{0, 0}, .2], Blue, 
   Disk[{Cos[\[Omega][1]*t], Sin[\[Omega][1]*t]}, .1], Brown, 
   Disk[{1.52*Cos[\[Omega][1.52]*t], 1.52*Sin[\[Omega][1.52]*t]}, .1],
    Black, Line[{{0, 0}, {Cos[\[Omega][1]*t], Sin[\[Omega][1]*t]}}], 
      Sin[\[Omega][1]*t]}, {1.52*Cos[\[Omega][1.52]*t], 
  PlotRange -> {{-2, 2}, {-2, 2}}], {t, 0, t0}]

enter image description here

Thank you very much.

Dear @Hojun Lee, Welcome to Wolfram Community! Please make sure you know the rules:

Please do not post code as images.

The rules explain how to format your code properly. If you do not format code, it may become corrupted and useless to other members. Please EDIT your post and make sure code blocks start on a new paragraph and look framed and colored like this.

int = Integrate[1/(x^3 - 1), x];
Map[Framed, int, Infinity]

enter image description here

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract