check_angular_momentum_conservation
Verify whether total angular momentum is conserved by comparing initial and final values within a tolerance, indicating if external torques acted on the system.
Instructions
Verify conservation of angular momentum.
Checks whether total angular momentum is conserved. Angular momentum
is conserved when no external torques act on the system.
Args:
initial_angular_momentum: Initial L [x, y, z] in kg⋅m²/s (or JSON string)
final_angular_momentum: Final L [x, y, z] in kg⋅m²/s (or JSON string)
tolerance: Tolerance (fraction, default 0.01 = 1%)
Returns:
Dict containing:
- initial_L_magnitude: Initial |L| in kg⋅m²/s
- final_L_magnitude: Final |L| in kg⋅m²/s
- L_difference: Difference [x, y, z]
- L_difference_magnitude: |ΔL|
- L_difference_percent: % difference
- is_conserved: Whether L is conserved within tolerance
Tips for LLMs:
- Conserved when no external torques (isolated rotation)
- Ice skater spinning: pull arms in → I decreases → ω increases (L constant)
- Gyroscope: resists changes to L direction
- Planets orbiting: L conserved → elliptical orbits
Example - Figure skater:
# Arms extended → Arms pulled in
result = await check_angular_momentum_conservation(
initial_angular_momentum=[0, 15, 0], # kg⋅m²/s
final_angular_momentum=[0, 15.05, 0],
tolerance=0.01
)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| initial_angular_momentum | Yes | ||
| final_angular_momentum | Yes | ||
| tolerance | No |
Implementation Reference
- MCP @tool decorated async handler for check_angular_momentum_conservation. Parses input vectors (list or JSON string), delegates to core calculation function from ..conservation, and returns the response dict.
@tool # type: ignore[arg-type] async def check_angular_momentum_conservation( initial_angular_momentum: Union[list[float], str], final_angular_momentum: Union[list[float], str], tolerance: float = 0.01, ) -> dict: """Verify conservation of angular momentum. Checks whether total angular momentum is conserved. Angular momentum is conserved when no external torques act on the system. Args: initial_angular_momentum: Initial L [x, y, z] in kg⋅m²/s (or JSON string) final_angular_momentum: Final L [x, y, z] in kg⋅m²/s (or JSON string) tolerance: Tolerance (fraction, default 0.01 = 1%) Returns: Dict containing: - initial_L_magnitude: Initial |L| in kg⋅m²/s - final_L_magnitude: Final |L| in kg⋅m²/s - L_difference: Difference [x, y, z] - L_difference_magnitude: |ΔL| - L_difference_percent: % difference - is_conserved: Whether L is conserved within tolerance Tips for LLMs: - Conserved when no external torques (isolated rotation) - Ice skater spinning: pull arms in → I decreases → ω increases (L constant) - Gyroscope: resists changes to L direction - Planets orbiting: L conserved → elliptical orbits Example - Figure skater: # Arms extended → Arms pulled in result = await check_angular_momentum_conservation( initial_angular_momentum=[0, 15, 0], # kg⋅m²/s final_angular_momentum=[0, 15.05, 0], tolerance=0.01 ) """ # Parse inputs parsed_L_i = ( json.loads(initial_angular_momentum) if isinstance(initial_angular_momentum, str) else initial_angular_momentum ) parsed_L_f = ( json.loads(final_angular_momentum) if isinstance(final_angular_momentum, str) else final_angular_momentum ) from ..conservation import ( AngularMomentumConservationCheckRequest, check_angular_momentum_conservation as check_L, ) request = AngularMomentumConservationCheckRequest( initial_angular_momentum=parsed_L_i, final_angular_momentum=parsed_L_f, tolerance=tolerance, ) response = check_L(request) return response.model_dump()