calculate_center_of_mass
Compute the center of mass for a system of point masses using mass and position data to determine the weighted average position.
Instructions
Calculate center of mass for a system of point masses.
Formula: r_cm = Σ(m_i × r_i) / Σm_i
Args:
masses: List of masses in kg (or JSON string)
positions: List of positions [[x,y,z], ...] in meters (or JSON string)
Returns:
Dict containing:
- center_of_mass: Position [x, y, z] in meters
- total_mass: Total system mass in kg
Example - Three-mass system:
result = await calculate_center_of_mass(
masses=[1.0, 2.0, 3.0],
positions=[[0,0,0], [1,0,0], [2,0,0]]
)
# center_of_mass ≈ [1.5, 0, 0]
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| masses | Yes | ||
| positions | Yes |