lmspace

lmspace is a native orbital mechanics and astronomy host for lmscript with N-body integration, Kepler propagation, transfers, and NASA NAIF CSPICE frames. It packs original MIT numerical algorithms and static CSPICE N0067 support into a single self-contained executable.

Quick reference

npm i -g @lmctl-ai/lmctl
lmscript orbit.lms
lmspace --version
lmspace --lmcode-schema --json
Object or function Signature Summary
space.body space.body(name, mu, x, y, z, vx, vy, vz) -> Body Create a body with gravitational parameter mu and Cartesian state
space.system space.system() -> System Create an independent N-body system that copies added bodies
System.propagate sys.propagate(duration, points, step, method, tol) -> Matrix Integrate N-body trajectories with symplectic leapfrog or rk45
elements elements(a, e, i, raan, argp, nu) -> Elements Construct classical orbital elements (angles in radians)
hohmann hohmann(r1, r2, mu) -> Matrix Compute 1x3 matrix of departure delta-v, arrival delta-v, transfer time
lambert lambert(r1, r2, dt, mu, prograde) -> Matrix Solve zero-revolution Lambert boundary value problem (2x3 velocity matrix)
space.ephemeris space.ephemeris(target, observer, frame, et) -> Matrix Query geometric SPICE 1x6 state vector (km and km/s) at ET seconds past J2000
space.frame space.frame(from, to, et) -> Matrix Compute 3x3 SPICE coordinate rotation matrix between reference frames
p = _lmcode_ cli="lmspace" install="github:lmctl-ai/lmspace@latest";
let mu = 398600.4418;
let orbit = elements(7000.0, 0.1, 0.2, 0.3, 0.4, 0.5);
let initial = orbit.to_state(mu);
let transfer = hohmann(7000.0, 42164.0, mu);
space_assert_close(period(7000.0, mu), 5828.516637686015, 0.00000001);
transfer.save_csv("transfer.csv");
end _lmcode_
r = run_lmcode(p);
require(r.ok, "transfer failed");

Documentation pages

Source repository and releases