# Can a planet's orbit around a star be simulated? [closed]

Say I know all parameters like density, size, rotational velocity of a planet, could I predict its orbit around a star where I also know parameters of it? I want to design a simple model of the solar system as a practice of programming.

Say I had a 2D plane with a sun at the origin and a planet with known characteristics somewhere. What would I need to know to at least somewhat accurately plot its movement? Can a planet's orbit be deduced this way, say with a formula? If I can assume a planet is only affected by its star and not other planets.

• Specifically for plotting motion, how would that help? To give an arbitrary example, say I have a sun of size $x$ with density $y$, and a planet with size $w$ and density $z$. Sun is at 0,0, the planet is at some other point. I have the initial position of the planet, but what about its next position after all forces have acted upon it? – gator Jan 10 '16 at 16:58

If we define some parameter $u$ as $$u\equiv\frac{1}{r}\tag{1}$$ where $r$ is the radius of the orbit at some angle $\theta$, then, using the Euler-Lagrange equations, we eventually arrive at $$u=-\frac{GMm}{L^2}(1+e\cos(\theta-\theta_0))\tag{2}$$ where $M$ is the mass of the larger body, $m$ is the mass of the smaller body, $L$ is orbital angular momentum and $e$ is eccentricity. If you know the first three parameters, then $e$ can be calculated from the total energy of the orbit.