energy | R Documentation |
Computes the instantaneous potential and kinetic energies of all particles in an N-body system. Here, the potential energy of a particle i means the potential energy it has with all other particles (sum_j -G*m[i]*[j]/rij). Hence the total potential energy of the system is half the sum of the individual potential energies.
energy(m, x, v, rsmooth = 0, G = 6.67408e-11, cpp = TRUE)
m |
N-vector with the masses of the N particles. Negative masses are treated as positive masses of same magnitude, since negative masses normally represent positive background masses in the nbody package. |
x |
N-by-3 matrix specifying the initial position in Cartesian coordinates |
v |
N-by-3 matrix specifying the initial velocities |
rsmooth |
top-hat smoothing radius. |
G |
gravitational constant. The default is the measured value in SI units. |
cpp |
logical flag. If TRUE (default), the computation is performed efficiently in C++. |
Returns a list with vector items Ekin
, Epot
, Emec=Ekin+Epot
; and the associated total quantities Ekin.tot
, Epot.tot
, Emec=Ekin+Epot.tot
.
Danail Obreschkow
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.