angularmomentum: Compute the total angular momentum of a particle distribution

View source: R/angularmomentum.R

angularmomentumR Documentation

Compute the total angular momentum of a particle distribution

Description

Computes the total angular momentum of a set of particles about their centre of mass (or about a user-specified origin).

Usage

angularmomentum(m, x, v, x0 = NULL, v0 = NULL)

Arguments

m

n-vector or scalar of particle masses. For specific angular momentum computation, set m=1.

x

n\times3 matrix of particle positions.

v

n\times3 matrix of particle velocities.

x0

Optional 3-vector specifying the origin about which the angular momentum is computed. If NULL (default), the centre of mass is used.

v0

Optional 3-vector specifying the reference velocity. If NULL (default), the centre-of-mass velocity is used.

Value

A numeric vector of length three containing the Cartesian components of the total angular momentum,

\mathbf{J}=\sum_i m_i\,(\mathbf{x}_i-\mathbf{x}_0)\times (\mathbf{v}_i-\mathbf{v}_0).

If m is NULL, a vector of zeros is returned.

Examples

m = c(1, 2)
x = rbind(c(1, 0, 0), c(0, 1, 0))
v = rbind(c(0, 1, 0), c(-1, 0, 0))
angularmomentum(m, x, v)


cooltools documentation built on Sept. 11, 2026, 5:06 p.m.