Conservation of energy and angular momentum I'm writing a java program to simulate the solar system. All planets are modelled as point masses. How do I check if my solar system is conserving energy? I'm not sure how to calculate the energy of the system at the start of the simulation, let alone at the end! 
And given that my model is with point masses, presumably I can't calculate angular momentum at all? 
 A: The conserved quantities in your problem are: total mechanic energy $T+U$, total linear momentum $\vec P$, and total angular momentum $\vec L$ of the $N$ point masses. 
They are defined as:
$$E=T+U \quad\text{ total mechanical energy}$$ 
$$U=-G\sum_{i}^N \sum_{j}^N  \frac{m_i m_j}{|\vec r_i -\vec r_j|}\quad\text{ total potential energy}$$
$$T=\frac12\sum_i^N m_i v_i^2\quad\text{ total kinetic energy}$$
$$\vec P=\sum_i^N m_i \vec v_i \quad\text{ total linear momentum}$$
$$\vec L=\sum_i^N m_i (\vec r_i\times \vec v_i) \quad\text{ total angular momentum}$$
where $G$ is the gravitational constant (the gravitational force between 2 masses is $F=G \frac{m_i m_j}{(\vec r_i -\vec r_j)^2}$). 
Note that: 
$m_i$, $\vec r_i$, and $\vec v_i$ are the mass, the position, and the velocity of the point mass $i$.
only the total mechanical energy $E=T+U$ is conserved, while the total kinetic and total potential energies are not conserved separately;
the total linear and angular momenta are vectors, while total energies are scalars;
you must include also the sun in the sums over point masses $i=1,...,N$ and $j=1,...,N$ in the definition of the energies and momenta. 
A point mass has a well defined angular momentum $m (\vec r \times \vec v)$ which is non-zero if the mass is rotating around another mass (or any point in the space).
