A vector needs a meaning and a frame
The array [1, 0, 0] is not yet a physical statement. Is it a point, a direction, a velocity, or a force? Is it expressed in the robot body frame or the world frame? Correct arithmetic begins by answering both questions.
The dot product measures alignment:
The cross product produces a vector perpendicular to two inputs. Mechanics uses it for torque and point velocity:
It is often useful to write the cross product as matrix multiplication:
def skew(vector):
x, y, z = vector
return np.array([
[0, -z, y],
[z, 0, -x],
[-y, x, 0],
], dtype=float)Points translate; free vectors only rotate
A rigid transform contains a rotation and translation . A local point includes both:
A direction, angular velocity, or force has no location, so translation does not apply:
A valid rotation satisfies and . Its inverse is therefore its transpose. The inverse rigid transform is:
Linear systems and quadratic forms
Simulation repeatedly solves equations that can be organized as:
may encode inertia, constraint coupling, or a local approximation to nonlinear dynamics. We normally solve the system with a factorization instead of explicitly forming . Explicit inversion does more work, hides exploitable structure, and often magnifies numerical error.
A quadratic form maps a direction to a scalar:
When symmetric is positive definite, for every nonzero . Mass and inertia matrices should have this property: every nonzero velocity stores positive kinetic energy.
Experiment 1: find the principal axes
Rotate and diagonalize an inertia tensor
If a box is rotated in the world, did its physical resistance to rotation change—or only its coordinates?
A uniform box aligned with its body axes has diagonal inertia:
Expressed in world coordinates, the same tensor becomes:
The eigenvectors of point along the rotated principal axes. The eigenvalues are the principal moments and remain unchanged by rotation.

- Expected result
- The command exits successfully and reproduces the numerical or visual relationship described in this card.
- Failure modes
- Non-finite values, a reversed trend, a failed assertion, or a materially different plot means the assumptions, seed, timestep, build, or backend should be inspected before continuing.
Experiment 2: differentiate a two-link arm
For link lengths and joint angles , the planar tip is:
The Jacobian contains the derivative of every output coordinate with respect to every input coordinate:
It maps joint velocity to instantaneous Cartesian tip velocity:
Check the analytic Jacobian numerically
How do we catch a missing sign or an incorrect joint-angle sum before using the Jacobian in a controller?
Central differences perturb one coordinate in both directions:
At , the analytic and finite-difference matrices agree with Frobenius error below 8e-11. This is a reusable verification pattern for kinematics, sensors, and reward gradients.
analytic = two_link_jacobian(q)
numeric = finite_difference_jacobian(two_link_tip, q)
assert np.allclose(analytic, numeric, atol=2e-10)- Expected result
- The command exits successfully and reproduces the numerical or visual relationship described in this card.
- Failure modes
- Non-finite values, a reversed trend, a failed assertion, or a materially different plot means the assumptions, seed, timestep, build, or backend should be inspected before continuing.
Experiment 3: lose a motion direction
A singular value measures how strongly a matrix maps a particular input direction. The condition number is the ratio between the largest and smallest singular values:
When the arm is straight, both Jacobian columns point along the same Cartesian direction. Rank falls from two to one, , and the condition number is infinite.

Structure matters as systems grow
In a serial chain, joint 1 affects every downstream link. Joint 16 affects only link 16. Most relationships in a large multibody model are local, leaving predictable zeros in Jacobians and mass-matrix factorizations.

Experiment 4: predict a named site's velocity
Reconstruct native site telemetry
Does LavenderSim's reported site velocity match the rigid-body point-velocity equation?
LavenderSim stores each body's world position, quaternion, linear velocity, and angular velocity. A named site supplies a body-local offset. After rotating that offset into the world as , its velocity is:
body = sim.body_state()[0]
site = sim.site_data()["tool.tip"]
offset_world = site[:3] - body[:3]
twist = np.r_[body[7:10], body[10:13]]
J_site = np.c_[np.eye(3), -skew(offset_world)]
predicted = J_site @ twist
measured = site[7:10]Across twelve rotating states, the maximum prediction error is below 1.4e-8 m/s, consistent with float32 telemetry roundoff.
site_data() rotates the local offset and evaluates the same cross product. This comparison verifies actual package behavior; it is not a separate browser approximation.- Expected result
- The command exits successfully and reproduces the numerical or visual relationship described in this card.
- Failure modes
- Non-finite values, a reversed trend, a failed assertion, or a materially different plot means the assumptions, seed, timestep, build, or backend should be inspected before continuing.
Paw-check: make the matrices answer
- Change the box dimensions so two principal moments become equal. What happens to the uniqueness of the corresponding eigenvectors?
- Choose a joint velocity and use to predict the two-link tip direction. Confirm it with a tiny finite step.
- Find all elbow angles where the two-link Jacobian determinant is zero.
- Move
tool.tipto the body center. Which three columns of its point Jacobian stop contributing? - Count the nonzero blocks for a 100-link serial chain without allocating the full matrix.
What should I be able to say now?
Transforms act differently on points and free vectors. Symmetric positive-definite matrices encode positive mechanical energy. Eigenvectors reveal principal directions, while Jacobians convert coordinate rates and expose singularities. Mechanical matrices are usually structured and sparse, which later enables recursive algorithms and efficient constraint solves.