markdown - original modelica
display: latex
compile: javascript - python - scheme

Simple/classical Inverse-square law force

$$\begin{array}{rcl} F & = & \frac{ G \cdot m_{ 1 } \cdot m_{ 2 } }{ r^{ 2 } } \\ \end{array}$$
Variable Type Description Value (default) Datatype
\(G\) parameter Gravitational Constant \(0.00000000006674\) Real
\(m_{ 1 }\) free mass #1 \(\) Real
\(m_{ 2 }\) free mass #2 \(\) Real
\(r\) free radius \(\) Real
\(F\) free force \(\) Real

Newton's law of universal gravitation states that a particle attracts every other particle in the universe using a force that is directly proportional to the product of their masses and inversely proportional to the square of the distance between them. This is a general physical law derived from empirical observations by what Isaac Newton called inductive reasoning. It is a part of classical mechanics and was formulated in Newton's work Philosophiæ Naturalis Principia Mathematica ("the Principia"), first published on 5 July 1687. (When Newton's book was presented in 1686 to the Royal Society, Robert Hooke made a claim that Newton had obtained the inverse square law from him; see the History section below.)

In modern language, the law states: Every point mass attracts every single other point mass by a force pointing along the line intersecting both points. The force is proportional to the product of the two masses and inversely proportional to the square of the distance between them. The first test of Newton's theory of gravitation between masses in the laboratory was the Cavendish experiment conducted by the British scientist Henry Cavendish in 1798. It took place 111 years after the publication of Newton's Principia and approximately 71 years after his death.

Newton's law of gravitation resembles Coulomb's law of electrical forces, which is used to calculate the magnitude of the electrical force arising between two charged bodies. Both are inverse-square laws, where force is inversely proportional to the square of the distance between the bodies. Coulomb's law has the product of two charges in place of the product of the masses, and the electrostatic constant in place of the gravitational constant.


Newton's law has since been superseded by Albert Einstein's theory of general relativity, but it continues to be used as an excellent approximation of the effects of gravity in most applications. Relativity is required only when there is a need for extreme precision, or when dealing with very strong gravitational fields, such as those found near extremely massive and dense objects, or at very close distances (such as Mercury's orbit around the Sun).

Observational Foils

Newton's Theory does not fully explain the precession of the perihelion of the orbits of the planets, especially of planet Mercury, which was detected long after the life of Newton. There is a 43 arcsecond per century discrepancy between the Newtonian calculation, which arises only from the gravitational attractions from the other planets, and the observed precession, made with advanced telescopes during the 19th century.

The predicted angular deflection of light rays by gravity that is calculated by using Newton's Theory is only one-half of the deflection that is actually observed by astronomers. Calculations using General Relativity are in much closer agreement with the astronomical observations.

In spiral galaxies, the orbiting of stars around their centers seems to strongly disobey Newton's law of universal gravitation. Astrophysicists, however, explain this spectacular phenomenon in the framework of Newton's laws, with the presence of large amounts of Dark matter.

Solutions to the equation

The n-body problem is an ancient, classical problem of predicting the individual motions of a group of celestial objects interacting with each other gravitationally. Solving this problem — from the time of the Greeks and on — has been motivated by the desire to understand the motions of the Sun, planets and the visible stars. In the 20th century, understanding the dynamics of globular cluster star systems became an important n-body problem too. The n-body problem in general relativity is considerably more difficult to solve.

The classical physical problem can be informally stated as: given the quasi-steady orbital properties (instantaneous position, velocity and time) of a group of celestial bodies, predict their interactive forces; and consequently, predict their true orbital motions for all future times.

The two-body problem has been completely solved, as has the Restricted 3-Body Problem.


The body of this page originally came from Wikipedia.

Modelica Code

model NewtonianGravitation
  "Simple/classical Inverse-square law force"
  parameter Real G=6.674e-11  "Gravitational Constant";
  Real m_1 "mass #1";
  Real m_2 "mass #2";
  Real r "radius";
  Real F "force";
  F = (((G * m_1) * m_2) / (r ^ 2));
end NewtonianGravitation;

examples - sandbox - readme - source code