Skip to content

tlehman/newton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Newtonian physics in java

Newtonian physics gives a way to predict the future state of a system of massive objects in a Euclidean space. This project library of classes such as com.tobilehman.newton.Point, com.tobilehman.newton.Vector and com.tobilehman.newton.Body. The com.tobilehman.newton.Universe class enables a system built from these classes to be evolved forward in time according to Newton's laws of motion.

Note: all bold quantities are vectors. SI units are assumed everywhere, here's a brief list in case you don't remember all the SI units:

  • Time is measured in seconds (s)
  • Length is measured in meters (m)
  • Mass is measured in kilograms (kg)

There are more, but none are relevant to the newtonian library, it only deals with space, time and mass.

The unit for force is sometimes abbreviated (N), as Newtons, but it is defined in terms of kilograms, meters and seconds.

Newton's laws of motion

  1. An object either remains at rest or continues to move at a constant velocity unless acted upon by a force.

  2. The vector sum of external forces F acting on an object is equal to the object's mass m times the acceleration vector a.

  3. When one body exerts a force on another body, the other body exerts an equal and opposite force on the original body.

The first law can be summarized as:

x(t + Δt) = x(t) + v0Δt

(assuming a(t)=0)

The second law can be summarized as:

F = m a

The third law can be summarized as:

F1 = -F2

Conservation of momentum

Newton derived the conservation of momentum from his three laws, but later developments in physics, such as electromagnetism and quantum mechanics show that conservation of momentum is actually the more fundamental principle, so I will state it here axiomatically.

Momentum is usually denoted with a p, and it is defines as the product of an objects mass and velocity:

p = mv

Newton's second and third laws can also be summarized as

F = (d/dt)p

Where (d/dt) means the "rate of change with respect to time". If you are not familiar with calculus, this is called a derivative.

Newton's law of universal gravitation

Given two objects with masses m1 and m2, the force of gravity on object two from object one is:

F21 = (Gm1m2/r2)21

Where r = ||r21|| (the norm (length) of the vector from object 2 to object 1), and

21 is a vector in the direction of r21, but with a magnitude (norm) of 1.

And G is the gravitational constant: 6.673×10−11 N (m/kg)2

image of two massive bodies and their force on each other

Releases

No releases published

Packages

No packages published

Languages