Adds a point mass with a given starting position and velocity (its Cartesian state vector). This is the most general way to place a body: you say exactly where it is and how it is moving. To describe an orbit by its shape instead, use add_body_keplerian(), and for a real planet use add_planet(). Also available as orb.add_body(system, ...).
Parameters
Name
Type
Description
Default
id
str
A unique name for the body, such as "Earth". It labels the body in the results and is how other functions refer to it.
required
mass
float
Mass in kilograms. Must be zero or positive. A mass of 0 gives a test particle that feels gravity but exerts none.
required
x
float
Initial position along the x axis, in meters. Default 0.
0
y
float
Initial position along the y axis, in meters. Default 0.
0
z
float
Initial position along the z axis, in meters. Default 0.
0
vx
float
Initial velocity along the x axis, in meters per second. Default 0.
0
vy
float
Initial velocity along the y axis, in meters per second. Default 0.
0
vz
float
Initial velocity along the z axis, in meters per second. Default 0.
0
Returns
Name
Type
Description
OrbitSystem
A new system with the body added as the last row. The original system is not modified.
Raises
Name
Type
Description
ValueError
If a body named id already exists, if mass is not a single number, or if mass is negative.