Invntr
Source

All instruments

rigid_body_spin

Torque-free rotation of a rigid body: Euler's equations in the principal body frame, integrated by classical RK4. Gives the angular velocity history, the conserved rotational energy and angular momentum and how far RK4 drifted from them, the polhode (body-frame precession) period by the Jacobi-elliptic closed form and as measured from the history, the body- and space-frame precession rates of an axisymmetric body, and for steady spin about each principal axis whether it is stable, with the wobble or growth rate by the linearised closed form and as measured by a perturbed RK4 probe. The body is given by its three principal moments or as a uniform box. Writes out/trace.csv and out/stability.csv.

Field
Dynamics and control
Version
0.1.0
Runs as
Compiled (Rust)
Typical run
0.1 s

Compiled from source: run sh packs/install.sh once before admitting it.

Known answers it must pass

Admission replayrigid_body_spin 0.1.0 · files d1a6f135e291…c87c
  1. r0001axisymmetric body I=(2,2,3), w=(0.1,0,1): body-frame precession (I3-I1)/I1*w3 = 0.5 rad/s, period 4 pi; after two periods (8 pi s) w returns to its start (Goldstein, free symmetric top). RK4 tolerance 1e-8 at h = 2.5e-4 spassed

    body_precession_rate_rad_per_s0.5 ± 5e-130.5lockedunder 0.01 % of the tolerance used
    precession_rate_measured_rad_per_s0.5 ± 5e-070.5lockedunder 0.01 % of the tolerance used
    polhode_period_s12.5664 ± 1.3e-0812.5664lockedunder 0.01 % of the tolerance used
    space_precession_rate_rad_per_s1.50333 ± 1.5e-091.50333lockedunder 0.01 % of the tolerance used
    energy_J1.51 ± 1.5e-121.51lockedunder 0.01 % of the tolerance used
    angular_momentum_kg_m2_per_s3.00666 ± 3e-123.00666locked0.015 % of the tolerance used
    omega1_final_rad_per_s0.1 ± 1e-080.1lockedunder 0.01 % of the tolerance used
    omega2_final_rad_per_s0 ± 1e-081.81499e-16lockedunder 0.01 % of the tolerance used
    omega3_final_rad_per_s1 ± 1e-121lockedunder 0.01 % of the tolerance used
    energy_drift_rel≤ 1e-100lockedinside the range
    angular_momentum_drift_rel≤ 1e-100lockedinside the range
  2. r0002sphere I=(2.5,2.5,2.5): Euler's equations give zero rate of change, so the angular velocity never moves; E = I|w|^2/2 = 2.1125 J, L = I|w| = 3.25passed

    omega_max_change_rad_per_s0 ± 1e-140lockedunder 0.01 % of the tolerance used
    omega1_final_rad_per_s0.3 ± 1e-140.3lockedunder 0.01 % of the tolerance used
    omega2_final_rad_per_s-0.4 ± 1e-14-0.4lockedunder 0.01 % of the tolerance used
    omega3_final_rad_per_s1.2 ± 1e-141.2lockedunder 0.01 % of the tolerance used
    energy_J2.1125 ± 2.1e-122.1125lockedunder 0.01 % of the tolerance used
    angular_momentum_kg_m2_per_s3.25 ± 3.3e-123.25lockedunder 0.01 % of the tolerance used
    unstable_axis= lockedexact match
    regime= spherespherelockedexact match
  3. r0003triaxial I=(1,2,3), w=(sqrt 3, 0, sqrt 2): modulus k^2 = 1/2 exactly, so the polhode period is 4 K / sqrt 2 with K(1/2) = Gamma(1/4)^2 / (4 sqrt pi) = 1.8540746773013719 (lemniscatic value), T = 5.244115108584239 s (Landau & Lifshitz section 37); E = 4.5 J, L = sqrt 21. Measured period 1e-6: linear interpolation of zero crossings at h = 1e-3 spassed

    polhode_period_s5.24412 ± 5.2e-095.24412lockedunder 0.01 % of the tolerance used
    polhode_period_measured_s5.24412 ± 5.2e-065.24412lockedunder 0.01 % of the tolerance used
    energy_J4.5 ± 4.5e-124.5lockedunder 0.01 % of the tolerance used
    angular_momentum_kg_m2_per_s4.58258 ± 4.6e-124.58258locked0.019 % of the tolerance used
    polhode_circles_axis= 33lockedexact match
    energy_drift_rel≤ 1e-092.86191e-14lockedinside the range
    angular_momentum_drift_rel≤ 1e-091.27919e-14lockedinside the range
  4. r0004I=(1,2,3), w=(0,1,0.01) so |w| = sqrt 1.0001: linearised Euler equations for steady spin at |w| give growth rate |w| sqrt((I2-I1)(I3-I2)/(I1 I3)) = sqrt(1.0001/3) about axis 2 and wobble rates |w| sqrt((Ia-Ij)(Ia-Ik)/(Ij Ik)) = sqrt(1.0001/3) (axis 1) and sqrt 1.0001 (axis 3); the spin near axis 2 leaves it (flips past 90 deg), a kick about axes 1 and 3 stays at its size (amplification 1). Measured rates 1e-3: linear theory read from a finite 1e-6 kickpassed

    unstable_axis= 22lockedexact match
    spin_stable= falsefalselockedexact match
    max_axis_deviation_deg90 to 180178.854lockedinside the range
    stability.axis_2.kind= unstablemisseddiffers
    omega0_rad_per_s1.00005 ± 1e-121.00005lockedunder 0.01 % of the tolerance used
    stability.axis_2.rate_closed_rad_per_s{"value": 0.5773791359814334, "rel_tol": 1e-09}
    stability.axis_2.rate_measured_rad_per_s{"value": 0.5773791359814334, "rel_tol": 0.001}
    stability.axis_2.amplification{"min": 1000.0}
    stability.axis_1.kind= stablemisseddiffers
    stability.axis_1.rate_measured_rad_per_s{"value": 0.5773791359814334, "rel_tol": 0.001}
    stability.axis_1.amplification{"value": 1.0, "rel_tol": 1e-06}
    stability.axis_3.kind= stablemisseddiffers
    stability.axis_3.rate_measured_rad_per_s{"value": 1.0000499987500624, "rel_tol": 0.001}
    stability.axis_3.amplification{"value": 1.0, "rel_tol": 1e-06}
    energy_drift_rel≤ 1e-091.68729e-14lockedinside the range
  5. r0005uniform box 1.2 kg, 0.1 x 0.2 x 0.4 m: I = m (b^2 + c^2) / 12 gives (0.02, 0.017, 0.005) kg m^2 (textbook cuboid); the intermediate axis is axis 2 (y), growth rate at 10 rad/s = 10 sqrt((0.003)(0.012)/(0.02*0.005)) = 6 rad/spassed

    I1_kg_m20.02 ± 2e-140.02locked0.017 % of the tolerance used
    I2_kg_m20.017 ± 1.7e-140.017locked0.02 % of the tolerance used
    I3_kg_m20.005 ± 5e-150.005locked0.017 % of the tolerance used
    unstable_axis= 22lockedexact match
    stability.axis_2.rate_closed_rad_per_s{"value": 6.0, "rel_tol": 1e-09}
    stability.axis_2.rate_measured_rad_per_s{"value": 6.0, "rel_tol": 0.001}
    spin_stable= truetruelockedexact match
    energy_J1 ± 1e-121locked0.022 % of the tolerance used
    omega_max_change_rad_per_s0 ± 1e-120lockedunder 0.01 % of the tolerance used
  6. r0006I=(3,2,1), steady spin 2 rad/s about axis 3 (smallest moment): linearised wobble rate w sqrt((I3-I1)(I3-I2)/(I1 I2)) = 2/sqrt 3, so the small-wobble polhode period is 2 pi sqrt 3 / 2 = pi sqrt 3 (k -> 0, K = pi/2); the wobble is an ellipse with axis ratio sqrt(I1 (I3-I1) / (I2 (I3-I2))) = sqrt 3, so a kick about axis 1 grows to sqrt 3 times its size and no further; axis 1 wobbles at 2 sqrt((3-2)(3-1)/(2*1)) = 2 rad/s; axis 2 grows at 2 sqrt((3-2)(2-1)/(3*1)) = 2/sqrt 3. Amplification 1e-5: the peak is read from 2000 samples per wobblepassed

    polhode_period_s5.4414 ± 5.4e-095.4414lockedunder 0.01 % of the tolerance used
    polhode_circles_axis= 33lockedexact match
    regime= smallestsmallestlockedexact match
    stability.axis_3.kind= stablemisseddiffers
    stability.axis_3.rate_closed_rad_per_s{"value": 1.1547005383792517, "rel_tol": 1e-09}
    stability.axis_3.rate_measured_rad_per_s{"value": 1.1547005383792517, "rel_tol": 1e-06}
    stability.axis_3.amplification{"value": 1.7320508075688772, "rel_tol": 1e-05}
    stability.axis_3.wobble_amplification_closed{"value": 1.7320508075688772, "rel_tol": 1e-09}
    stability.axis_1.rate_closed_rad_per_s{"value": 2.0, "rel_tol": 1e-09}
    stability.axis_1.rate_measured_rad_per_s{"value": 2.0, "rel_tol": 1e-06}
    stability.axis_2.kind= unstablemisseddiffers
    stability.axis_2.rate_closed_rad_per_s{"value": 1.1547005383792517, "rel_tol": 1e-09}
    unstable_axis= 22lockedexact match
    spin_stable= truetruelockedexact match
    energy_J2 ± 2e-122lockedunder 0.01 % of the tolerance used
    angular_momentum_kg_m2_per_s2 ± 2e-122lockedunder 0.01 % of the tolerance used
  7. r0007scale check, I=(1,2,3)e-300 kg m^2, w=(sqrt 3, 0, sqrt 2): Euler's equations hold only ratios of the moments, so the period is the same T = 4 K(1/2) / sqrt 2 = 5.244115108584239 s as for I=(1,2,3) (Landau & Lifshitz section 37) and the stability rates are |w| sqrt(1/3) and |w| with |w| = sqrt 5passed

    polhode_period_s5.24412 ± 5.2e-095.24412lockedunder 0.01 % of the tolerance used
    polhode_period_measured_s5.24412 ± 5.2e-065.24412lockedunder 0.01 % of the tolerance used
    polhode_circles_axis= 33lockedexact match
    unstable_axis= 22lockedexact match
    stability.axis_2.rate_closed_rad_per_s{"value": 1.2909944487358056, "rel_tol": 1e-09}
    stability.axis_3.rate_closed_rad_per_s{"value": 2.23606797749979, "rel_tol": 1e-09}
    stability.axis_3.kind= stablemisseddiffers
7 of 7 cases passed · sandbox macos-seatbeltrecorded from the kernel in a fresh lab

Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.

Inputs

NameUnitDefaultMeaning
bodymoments"moments": give I1_kg_m2, I2_kg_m2, I3_kg_m2. "box": a uniform rectangular block, give mass_kg and size_x_m, size_y_m, size_z_m (axis 1 is x, 2 is y, 3 is z).
I1_kg_m2kg m^21.0Principal moment of inertia about body axis 1.
I2_kg_m2kg m^22.0Principal moment of inertia about body axis 2.
I3_kg_m2kg m^23.0Principal moment of inertia about body axis 3.
mass_kgkg1.0Box only: mass.
size_x_mm0.1Box only: edge along body axis 1.
size_y_mm0.2Box only: edge along body axis 2.
size_z_mm0.3Box only: edge along body axis 3.
omega1_rad_per_srad/s0.0Initial angular velocity about body axis 1.
omega2_rad_per_srad/s0.01Initial angular velocity about body axis 2.
omega3_rad_per_srad/s1.0Initial angular velocity about body axis 3.
duration_ss60.0How long to integrate.
steps160000RK4 steps over duration_s.
perturbation11e-06Stability probe: the sideways kick given to steady spin about each axis, as a fraction of the spin rate.

Readings

NameUnitMeaning
body1
I1_kg_m2kg m^2
I2_kg_m2kg m^2
I3_kg_m2kg m^2
omega0_rad_per_srad/sinitial spin rate |omega|
energy_JJrotational kinetic energy at the start, (I1 w1^2 + I2 w2^2 + I3 w3^2)/2
angular_momentum_kg_m2_per_skg m^2/s|L| at the start
energy_drift_rel1largest relative change of the energy over the RK4 history
angular_momentum_drift_rel1largest relative change of |L| over the RK4 history
omega1_final_rad_per_srad/s
omega2_final_rad_per_srad/s
omega3_final_rad_per_srad/s
omega_min_rad_per_srad/slowest value of each body-frame component over the history
omega_max_rad_per_srad/shighest value of each body-frame component over the history
omega_max_change_rad_per_srad/slargest distance of the body-frame angular velocity from its start
max_axis_deviation_degdeglargest angle between the body-frame angular velocity and its start
polhode_period_ssclosed form 4 K(k) / lambda (Landau & Lifshitz, Mechanics, section 37); for spin exactly about the largest or smallest axis it is the period of a vanishingly small wobble; null for a sphere, on the separatrix (which includes spin exactly about the intermediate axis) and for spin in the plane of two equal moments
polhode_period_measured_ssfrom zero crossings of the intermediate-axis component in the RK4 history
polhode_period_rel_error1
precession_rate_rad_per_srad/s2 pi / polhode_period_s
precession_rate_measured_rad_per_srad/s
body_precession_rate_rad_per_srad/saxisymmetric body only: (I_axis - I_side) / I_side * omega_axis, signed; null otherwise
space_precession_rate_rad_per_srad/saxisymmetric body only: |L| / I_side, the rate the symmetry axis cones about L
polhode_circles_axis11, 2 or 3: the principal axis the angular velocity circles in the body
regime1largest or smallest: the principal axis the angular velocity circles; separatrix: on the dividing line (includes spin exactly about the intermediate axis); steady: spin in the plane of two equal moments, it does not move; sphere
nearest_axis1
start_off_axis_degdeg
unstable_axis1the intermediate axis, or null when two moments are equal
spin_stable1false when the largest component of the starting spin is about the intermediate axis; a rule of thumb, read max_axis_deviation_deg for what the spin actually did
stabilitysteady spin at omega0 about each principal axis: kind (stable, unstable, or neutral when the axis is one of two equal moments: a kick then neither oscillates nor grows exponentially, it can drift in proportion to time), closed-form and measured rate, measured growth of the kick
steps1
step_ss
duration_ss

Try the call

Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.

Terminal
MCP call