Libraries‎ > ‎orbits‎ > ‎

Find total momentum

BehaviourComposer: ignore everything before this.

Begin micro-behaviour:

Begin description:

find the total momentum of all the bodies.

End description

Find total momentum

Begin NetLogo code:

let bodies objects with [my-mass > 0]
set the-total-momentum-x sum [my-mass * xvelocity ] of bodies 
set the-total-momentum-y sum [my-mass * yvelocity ] of bodies
if the-world-is-3-d?
 [ set the-total-momentum-z sum [my-mass * zvelocity ] of bodies ]

End NetLogo code

This micro-behaviour finds the momentum of the entire solar system by summing the mass times the velocity of every body in the system.

Authored by Maria Marinari and Ken Kahn.  

BehaviourComposer: ignore everything after this.