NBodySimulationData

NBodySimulationData[data]

represents the result of an n-body simulation.

Details

  • NBodySimulation generates an NBodySimulationData object.
  • The following operations can be performed on an NBodySimulationData[] object nbsd:
  • nbsd[b,t]state of body b at time t
    nbsd[{b1,b2,},t]states of bodies bi at time t
    nbsd[All,t]states of all bodies at time t
    nbsd[b,prop,t]value of property prop for body b at time t
    nbsd[bodies,prop,t]list of values of prop for multiple bodies at time t
    nbsd["comb",t]value of a combined quantity at time t
    nbsd["sim"]overall simulation property sim
  • Possible combined quantities include:
  • "TotalKineticEnergy"total (nonrelativistic) kinetic energy for all bodies
    "TotalPairwiseInteractionEnergy"total pairwise interaction energy of all bodies
    "TotalEnergy"total kinetic and pairwise ineraction energy
  • Possible overall simulation properties include:
  • "Equations"differential equations of motion
    "HamiltonEquations"differential equations in Hamiltonian form
    "SimulationTime"total simulation time

Examples

Basic Examples  (2)

Simulate a three-body problem in two dimensions:

In[1]:=
Click for copyable input
Out[1]=

Get the data for body 1 at time t=4:

In[3]:=
Click for copyable input
Out[3]=

Plot the positions of the bodies:

In[4]:=
Click for copyable input
Out[4]=

Plot the velocity for bodies 2 and 3:

In[15]:=
Click for copyable input
Out[15]=

Continue a simulation further:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

The new data has the same body parameters as the original:

In[3]:=
Click for copyable input
Out[3]=

The new data contains the simulation data from the original. Plot the position of the bodies:

In[4]:=
Click for copyable input
Out[4]=
Introduced in 2019
(12.0)