Maths Applied1.1

All books

S01 — The corner as a model

A wheel moves 40 mm up and 40 mm down. How far does its camber change, and what is the simplest model that answers to a tenth of a degree? Before any of that can be computed, the mechanism has to become equations: bodies with unknown poses, joints that each lock some of the six ways two bodies can move apart, and a count that says whether the equations pin the mechanism down to exactly the one motion the question drives. This notebook builds that translation with solvers/otkd, the package the chapter's numbers come from, and runs its check and compile on the real corner.

M08 §1–§2 used the same corner to choose a solver. This notebook stays one step earlier: what the rows are, where they come from, and how to count them.

Book pages: Chapter 1: Suspension kinematics and 1.1 The question (with its Going deeper page, The four models, side by side) in books/maths-applied. Design record: solvers/otkd/docs/config-layer.md §1–§5 and §9, problem-mapping.md §2–§4, entry-points.md §4.

The question. How does a suspension corner become a set of equations a solver can be trusted with, and how do you know there are the right number of them?

By the end you can:

  • name the corner's parts, and define camber and toe from the axle vector, signs included
  • say what each of otkd's four input files holds, and why the topology has no numbers
  • write a joint as six components, each locked, free or compliant, and read a constraint kind as a named bundle of modes
  • count the unknowns (position and unit quaternion per moving body) and say why each body needs a norm row
  • name every row type (hard, driver, norm, axial, plane, spring) and its expression
  • compute mobility as n−rankn - \text{rank}, say when Grübler's count disagrees, and say why otkd chooses its solver from the rank

Assumes: M03 (rank and the SVD) and M08 §1–§2; vectors, rotation matrices, and what a Jacobian is.

How to use it: predict before you reveal, commit before you check, and move the controls until the equation's behaviour stops surprising you.

Predict first. Try first: replace the upper wishbone's hinge with two ball joints, one at the end of each leg. The model then has 21 unknowns (three moving bodies, seven numbers each) and 21 constraint rows (18 from the joints, 3 that fix each quaternion's length). Grübler's count, unknowns minus rows, gives mobility 0. Is the mechanism locked?

Choose a prediction

Check answer (without scripting)

Answer: No: it still has one freedom, and one of the 21 rows says nothing new. The rank of the 21 rows is 20. Two ball joints pin two points of the upper arm, which leaves it free to turn about the line through them: exactly the hinge. Six rows say what five said before, so mobility is 21−20=121 - 20 = 1.

Warm-up: remember

1. Newton's residual alternates between two values and never falls. The most likely cause?

Question 1
How sure?

2. In a least-squares fit Xβ^≈yX\hat\beta \approx y, the residual e=y−Xβ^e = y - X\hat\beta is orthogonal to

Question 2
How sure?

3. You pass a non-symmetric matrix to numpy.linalg.eigh. What happens?

Question 3
How sure?

Show answers and explanations

1. A Jacobian wrong by a constant factor, so each step overshoots. With J/2J/2 in place of JJ every step is twice the Newton step and lands as far past the root as it started. Check the Jacobian by finite differences.

2. every column of X, ones included. X⊤(y−Xβ^)=0X^\top(y - X\hat\beta) = 0 is the normal equations. The fit is the orthogonal projection of yy onto the columns of XX.

3. It returns the eigenvalues of the matrix built from its lower triangle, with no warning. eigh reads only the lower triangle by default, so the answer belongs to a different, symmetric matrix. Check np.allclose(A, A.T) first.

1. The question, the parts, and the two angles

Setting: the problem, its sets and its symbols

Problem. Given the corner's design points PkP_k (k∈Kk \in \mathcal{K}) and a drive θ∈Θ\theta \in \Theta, find for each θ\theta the wheel-centre travel Δz(θ)\Delta z(\theta), the axle's outboard unit vector n(θ)n(\theta), and from it the camber γ(θ)\gamma(\theta) and the toe τ(θ)\tau(\theta); then find the simplest model whose γ\gamma is within ε\varepsilon of the truth over all of Θ\Theta.

Symbol In Meaning
K\mathcal{K} finite set\text{finite set} point names: lcaf, lcar, ucaf, ucar, tri, lbj, ubj, wc, wco, tro
PkP_k R3\mathbb{R}^3 design position of point kk; xx outboard, yy forward, zz up; m
θ\theta Θ=[−0.10, 0.10]\Theta = [-0.10,\ 0.10] the drive (data): lower-arm rotation about its hinge from design, rad
wc(θ), wco(θ)w_c(\theta),\ w_{co}(\theta) R3\mathbb{R}^3 wheel centre, and a point on the axle outboard of it, m
n(θ)n(\theta) S2⊂R3S^2 \subset \mathbb{R}^3 axle unit vector (wco−wc)/∥wco−wc∥(w_{co} - w_c) / \lVert w_{co} - w_c \rVert, dimensionless
γ(θ)\gamma(\theta) (−90°, 90°)(-90°,\ 90°) camber arcsin⁡(−nz)\arcsin(-n_z), deg; positive when the top of the wheel leans out
ψ(θ)\psi(\theta) (−180°, 180°](-180°,\ 180°] plan-view heading atan2⁡(ny,nx)\operatorname{atan2}(n_y, n_x) of the axle, deg
τ(θ)\tau(\theta) (−180°, 180°](-180°,\ 180°] toe: ψ(θ)−ψ(0)\psi(\theta) - \psi(0), deg; positive for toe-in
Δz(θ)\Delta z(\theta) R\mathbb{R} wheel-centre height change from design, mm
ε\varepsilon R>0\mathbb{R}_{>0} the question's tolerance on camber: 0.1°
How these symbols connect

The design points PkP_k (k∈Kk \in \mathcal{K}, in metres) fix the corner's geometry at rest, and driving the lower arm to angle θ∈Θ\theta \in \Theta (rad) moves the upright and hence the two axle points wc(θ)w_c(\theta) and wco(θ)w_{co}(\theta) in R3\mathbb{R}^3. From wc(θ)w_c(\theta) alone we read the wheel-centre travel Δz(θ)\Delta z(\theta) (converted from metres to millimetres), while normalising wco(θ)−wc(θ)w_{co}(\theta) - w_c(\theta) produces the dimensionless axle unit vector n(θ)∈S2n(\theta) \in S^2. Its vertical component nzn_z gives camber γ(θ)=arcsin⁡(−nz)\gamma(\theta) = \arcsin(-n_z), and its horizontal components (nx,ny)(n_x, n_y) give heading ψ(θ)\psi(\theta) and toe τ(θ)=ψ(θ)−ψ(0)\tau(\theta) = \psi(\theta) - \psi(0), both in degrees; candidate models are judged by whether their camber curve stays within ε=0.1°\varepsilon = 0.1° of the full model across Θ\Theta.

Symbol-by-symbol notes
$P_k$ — design coordinates and axis convention

All design points Pk∈R3P_k \in \mathbb{R}^3 live in one right-hand world frame in metres: xx outboard, yy forward, zz up. Because the signs of camber and toe depend on xx pointing outboard, mirroring to a left-hand corner flips the sign conventions.

$\theta \in \Theta$ — driven input, not wheel height

The sweep prescribes the lower arm's hinge rotation θ\theta in radians over [−0.10, 0.10][-0.10,\ 0.10], rather than prescribing wheel height directly. The vertical wheel-centre travel Δz(θ)=1000 (wc,z(θ)−Pwc,z)\Delta z(\theta) = 1000\,(w_{c,z}(\theta) - P_{\mathrm{wc},z}) is an output in millimetres, not the independent variable.

$n(\theta) \in S^2$ — outboard axle unit vector

Defined as (wco−wc)/∥wco−wc∥(w_{co} - w_c)/\lVert w_{co} - w_c \rVert, n(θ)n(\theta) lies on the unit sphere S2⊂R3S^2 \subset \mathbb{R}^3 and is dimensionless, so its direction does not depend on how far outboard wcow_{co} sits from wcw_c. The wheel plane is perpendicular to n(θ)n(\theta), so tilting the wheel tilts n(θ)n(\theta) by the same angle.

$\gamma(\theta)$ — camber and its minus sign

Camber γ=arcsin⁡(−nz)\gamma = \arcsin(-n_z) is positive when the top of the wheel leans outboard, which dips the outboard end of the axle downward (nz<0n_z \lt 0) and explains the minus sign inside arcsin⁡\arcsin. It is reported in degrees and judged against the tolerance ε=0.1°\varepsilon = 0.1°.

$\psi(\theta)$ and $\tau(\theta)$ — heading versus toe

ψ(θ)=atan2⁡(ny,nx)\psi(\theta) = \operatorname{atan2}(n_y, n_x) is the absolute plan-view direction of the axle, whereas toe τ(θ)=ψ(θ)−ψ(0)\tau(\theta) = \psi(\theta) - \psi(0) is its change relative to the design pose θ=0\theta = 0. On this right-hand corner (xx outboard, yy forward), positive nyn_y swings the outboard axle end forward and turns the front of the wheel inboard (toe-in).

The question. The chapter's problem has two halves. How far does camber change over ±40 mm of travel needs a model that turns travel into an angle. What is the simplest model that answers to 0.1° needs a way to compare models, by the size of what each one leaves out against the tolerance. Both halves start from the same object.

The parts. A double-wishbone corner: two wishbones, each hinged to the body at two pivots and joined to the upright by a ball joint; an upright carrying the hub, so upright and wheel turn together; a tie rod from the steering rack to an arm on the upright, which stops the upright turning about the line through its ball joints. In otkd's example these are four bodies, and each owns the geometry points it carries:

body part points it owns
ground the car's body, fixed: the frame everything is measured in lcaf, lcar, ucaf, ucar, tri
lca lower wishbone (A-arm) (none: its joints are shared sites)
uca upper wishbone (none: its joints are shared sites)
up upright, with the hub and the wheel bolted to it lbj, ubj, wc, wco, tro

lcaf, lcar and ucaf, ucar are the front and rear pivots of each wishbone; lbj, ubj the ball joints; tri, tro the tie rod's inner and outer ends; wc the wheel centre and wco a point 0.100 m outboard on the axle. The tie rod is not a body at all: §3 says why.

Axes. xx lateral (positive outboard), yy forward, zz up, metres: a right-hand corner.

The two angles. Both come from the axle's outboard unit vector n=(wco−wc)/∣wco−wc∣n = (w_{co} - w_c)/|w_{co} - w_c|. The wheel's plane is perpendicular to nn.

At the design pose n=(1,0,0)n = (1, 0, 0), so this illustrative geometry starts at zero camber and zero toe.

What the study drives. Not the wheel: the lower arm's angle about its hinge, from −0.10 to +0.10 rad in 81 steps. That moves the wheel centre from -42.4 mm to +42.5 mm, the chapter's ±40 mm with a little to spare. Choosing the input is part of the model; otkd's ride-height example drives the road instead.

Predict first. Over that sweep, about ±42 mm of wheel-centre travel, how much does the camber change from one end to the other?

Choose a prediction

Check answer (without scripting)

Answer: about 2 degrees. The arms are of unequal length and not parallel, so the upright tilts as it rises: a couple of degrees over the travel, about twenty times the tolerance.

Reveal result (lock in your prediction above first)
0.30.440.580.720.860.0960.2080.320.4320.544linkageaxlewheelx, outboard (m)z, up (m)

At +0.0000 rad the wheel centre has moved +0.0 mm; camber +0.000°, toe +0.000°.

Over the whole sweep camber runs from +0.899° (full droop) to -1.129° (full bump): a change of 2.03°, 20 times the 0.1° tolerance. The wheel leans in at the top as it rises. Toe moves too, from +0.651° to -0.622° (bump steer), which a front view cannot see. These are otkd's committed results for this example (the book's payload); the rest of the notebook is about the equations that produce them.

Figure 1

2. Three files and a library

Setting: the problem, its sets and its symbols

Problem. Given a topology T\mathcal{T}, a kind library L\mathcal{L}, a geometry gg and a study σ\sigma, find the compiled problem: the rows Φ(q;g,θ)\Phi(q; g, \theta) and their Jacobian J=∂Φ/∂qJ = \partial \Phi / \partial q as functions of (q,g,θ)(q, g, \theta), derived from (T,L)(\mathcal{T}, \mathcal{L}) alone, so that a new gg needs no new derivation.

Symbol In Meaning
T\mathcal{T} topology\text{topology} bodies, sites, joints with their kinds, actuators; no numbers
L\mathcal{L} kind library\text{kind library} constraints.yaml: each kind's family and component modes
gg Rng\mathbb{R}^{n_g} geometry numbers: point coordinates (m), site-frame entries (dimensionless), lengths (m), compliances (m/N or rad/(N·m))
ngn_g N\mathbb{N} how many geometry numbers T\mathcal{T} asks for
σ\sigma study\text{study} drivers and their laws, loads, dropped rows, swept numbers
qq Rn\mathbb{R}^{n} the unknowns: every moving body's pose (§4)
θ\theta Ra\mathbb{R}^{a} drive values, one per actuator; rad or m
Φ\Phi Rn×Rng×Ra→Rr\mathbb{R}^{n} \times \mathbb{R}^{n_g} \times \mathbb{R}^{a} \to \mathbb{R}^{r} the rr rows; each carries its own unit (m, rad or none)
JJ Rr×n\mathbb{R}^{r \times n} ∂Φ/∂q\partial \Phi / \partial q, derived symbolically
κ\kappa (T,L)↦string(\mathcal{T}, \mathcal{L}) \mapsto \text{string} the compile cache key
How these symbols connect

otkd splits a model into symbolic structure and numerical data: the topology T\mathcal{T} and the kind library L\mathcal{L} determine the cache key κ(T,L)\kappa(\mathcal{T}, \mathcal{L}) and generate the symbolic residual map Φ(q;g,θ)\Phi(q; g, \theta) and its Jacobian J=∂Φ/∂qJ = \partial \Phi / \partial q once. The geometry vector g∈Rngg \in \mathbb{R}^{n_g} supplies the design numbers (coordinates, site frames, lengths and compliances), while the study σ\sigma supplies the drive values θ∈Ra\theta \in \mathbb{R}^a and any loads or dropped rows. Evaluating Φ\Phi and JJ at a candidate pose q∈Rnq \in \mathbb{R}^n plugs (q,g,θ)(q, g, \theta) into those compiled expressions without re-deriving them when gg changes.

Symbol-by-symbol notes
$\mathcal{T}$ and $\mathcal{L}$ — structure without numbers

T\mathcal{T} (topology.yaml) names bodies, sites, joints and actuators, while L\mathcal{L} (constraints.yaml) defines what each joint kind means as component modes. Neither file holds coordinates or lengths, so one symbolic derivation serves every geometry sharing that layout.

$g \in \mathbb{R}^{n_g}$ — packed geometry parameters

All numerical entries from geometry.yaml — point coordinates (m), site-frame matrix entries (dimensionless), axial lengths (m) and spring compliances (m/N or rad/(N·m)) — are packed into one vector of length ngn_g. Do not confuse gg with the unknown pose qq: gg is fixed during a solve and varies only across design variants.

$\Phi(q; g, \theta)$ and $J$ — compiled residual map and Jacobian

Φ\Phi maps unknowns q∈Rnq \in \mathbb{R}^n, geometry g∈Rngg \in \mathbb{R}^{n_g} and drives θ∈Ra\theta \in \mathbb{R}^a to rr scalar residuals whose units vary by row (metres, radians or dimensionless). Its Jacobian J=∂Φ/∂q∈Rr×nJ = \partial \Phi / \partial q \in \mathbb{R}^{r \times n} is differentiated symbolically with respect to qq only, treating gg and θ\theta as parameters.

$\theta \in \mathbb{R}^a$ and $\sigma$ — the study's prescribed inputs

σ\sigma (study.yaml) states the question being asked — which actuators are driven, which rows are dropped and which parameters are swept — and θ\theta holds the aa scalar drive values (radians for rotational actuators, metres for translational ones). Changing σ\sigma changes the question without altering the mechanism's geometry gg.

$\kappa(\mathcal{T}, \mathcal{L})$ — compile cache key

κ\kappa is a string computed solely from topology T\mathcal{T} and kind library L\mathcal{L}, never from gg. Two geometries with the same κ\kappa reuse the exact same compiled Φ\Phi and JJ expressions.

otkd owns no model. It reads four files:

file answers numbers?
topology.yaml which bodies, joined by which kinds of joint, at which sites; where the actuators are none
geometry.yaml every coordinate, direction, length, compliance and mass all
study.yaml which actuators are driven and how, loads, dropped rows, swept numbers the question's own
constraints.yaml what spherical, revolute, distance … mean none

The topology holds no numbers because it is the part that must not change when a design study loops over geometries. The same topology with a second geometry is a second design; with a second study it is a second question.

The split is what makes the derivation reusable. compile turns the topology and the kinds into symbolic rows and their Jacobian, with every geometry number left as a symbol: for this corner 67 of them (30 point, 36 site, 1 length entries: point coordinates, the nine entries of each frame joint's site axes, and the tie rod's length). The compiled functions take (q,g,θ)(q, g, \theta): pose, geometry, drive.

Checked here. Moving the lower ball joint 5 mm outboard changes exactly point.lbj.0 in gg. The compile cache key (topology plus kinds) is unchanged, and the second compile returned the very same row expressions, not a re-derivation. The derivation is the slow part (tens of seconds for this corner), so it is done once per topology.

source: solvers/otkd/examples/double-wishbone/topology.yaml:1
id: dw-1dof
constraints: ../constraints.yaml

# The book's §1: the wishbone as one rigid body per arm, one degree of freedom.
bodies:
  ground: {fixed: true, points: [lcaf, lcar, ucaf, ucar, tri]}
  lca: {points: []}
  uca: {points: []}
  up: {points: [lbj, ubj, wc, wco, tro]}

roles: {axle: [wc, wco]}

sites:
  lca-hinge: {origin: lcaf, z: lca-axis}
  uca-hinge: {origin: ucaf, z: uca-axis}
  lbj: {origin: lbj}
  ubj: {origin: ubj}
  tri: {origin: tri}
  tro: {origin: tro}

joints:
  - {name: lca-ground, kind: revolute, a: ground, b: lca, site: lca-hinge}
  - {name: uca-ground, kind: revolute, a: ground, b: uca, site: uca-hinge}
  - {name: lca-up, kind: spherical, a: lca, b: up, site: lbj}
  - {name: uca-up, kind: spherical, a: uca, b: up, site: ubj}
  - {name: tie-rod, kind: distance, a: ground, b: up, from: tri, to: tro}

actuators:
  - {name: lca-drive, joint: lca-ground, dof: rz, effort: position}
source: solvers/otkd/examples/double-wishbone/study.yaml:1
# ±0.10 rad of lower-arm rotation is ±42 mm of wheel-centre travel (a 0.42 m arm, amplified a
# little by the upright). The original ±0.35 rad assumed a 0.2 m arm; with this geometry it
# would be a 290 mm sweep. See docs/config-layer.md §10.
analysis: kinematics

drivers:
  - actuator: lca-drive
    law: {kind: linear, from: -0.10, to: 0.10, steps: 81}
source: solvers/otkd/examples/double-wishbone/geometry.yaml:1
# Every number in the model, in metres, at the design position.
# x lateral (positive outboard), y forward, z up. Illustrative, not a measured car.

points:
  lcaf: [0.300, 0.120, 0.150]
  lcar: [0.300, -0.120, 0.160]
  lbj: [0.720, 0.010, 0.150]
  ucaf: [0.380, 0.100, 0.480]
  ucar: [0.380, -0.100, 0.470]
  ubj: [0.680, 0.000, 0.520]
  wc: [0.760, 0.000, 0.320]
  wco: [0.860, 0.000, 0.320]
  tri: [0.330, 0.140, 0.300]
  tro: [0.700, 0.120, 0.310]

axes:
  lca-axis: [0.000000000, -0.999133073, 0.041630545]   # lcaf -> lcar, unit
  uca-axis: [0.000000000, -0.998752339, -0.049937617]  # ucaf -> ucar, unit

# `tie-rod.length` is omitted: it defaults to the design separation, which is exact.
# Giving it explicitly is a check; a rounded value is a real (if tiny) modelling error.

scalars:
  tyre-radius: 0.200
source: `open_textbook.otkd.problem.compile._key` — `solvers/otkd/src/open_textbook/otkd/problem/compile.py:435`

The compile cache key: topology and kinds, never geometry.

def _key(model: Model) -> str:
    return model.topology.model_dump_json() + "|" + "|".join(
        f"{name}:{kind.model_dump_json()}" for name, kind in sorted(model.kinds.items())
    )

3. Bodies, sites, and a joint as six components

Setting: the problem, its sets and its symbols

Problem. Given bodies A≠BA \ne B with poses (pA,RA)(p_A, R_A) and (pB,RB)(p_B, R_B), a site with origin oo and frame CC, and a kind μ\mu assigning each component i∈Ci \in \mathcal{C} a mode, find the scalar rows the joint contributes: di=0d_i = 0 or Vi=0V_i = 0 for each locked ii, nothing for a free ii, and a potential term 12gi2/ci\tfrac12 g_i^2 / c_i for a spring ii.

Symbol In Meaning
B\mathcal{B} finite set\text{finite set} bodies: one fixed (ground), the rest moving
A,BA, B B, A≠B\mathcal{B},\ A \ne B the bodies a joint connects, in the order a → b
pA,pBp_A, p_B R3\mathbb{R}^3 body positions, m
RA,RBR_A, R_B SO(3)SO(3) body rotations, dimensionless
qA,qBq_A, q_B S3⊂R4S^3 \subset \mathbb{R}^4 the bodies' unit quaternions (§4)
oo R3\mathbb{R}^3 site origin, world coordinates at design, m
CC SO(3)SO(3) site frame: columns are the site's x,y,zx, y, z in world; zz is the joint axis
xA,xBx_A, x_B R3\mathbb{R}^3 the site as carried by each body, p+Rop + R o, m
dd R3\mathbb{R}^3 relative translation CTRAT(xB−xA)C^{\mathsf T} R_A^{\mathsf T} (x_B - x_A), components tx,ty,tzt_x, t_y, t_z, m
ϕ, u\phi,\ u R×S2\mathbb{R} \times S^2 angle (rad) and unit axis of the relative rotation of BB from AA
VV R3\mathbb{R}^3 vector part of qA−1qBq_A^{-1} q_B in the site frame, components rx,ry,rzr_x, r_y, r_z, dimensionless
C\mathcal{C} {tx,ty,tz,rx,ry,rz}\{t_x, t_y, t_z, r_x, r_y, r_z\} components of the frame family; axial has {length}\{\text{length}\}, plane has {gap}\{\text{gap}\}
μ\mu C→{locked,free,spring}\mathcal{C} \to \{\text{locked}, \text{free}, \text{spring}\} a kind: the mode of each component
gig_i R\mathbb{R} the residual of component ii (did_i, ViV_i, or a length or gap error); m or none
cic_i R≥0\mathbb{R}_{\ge 0} compliance of a spring component, m/N or rad/(N·m)
LL R>0\mathbb{R}_{>0} a distance joint's length, m
How these symbols connect

For two bodies A,B∈BA, B \in \mathcal{B} sharing a site (o,C)(o, C) at design, their poses (pA,RA)(p_A, R_A) and (pB,RB)(p_B, R_B) carry the common origin oo to xAx_A and xBx_B in world coordinates, and projecting xB−xAx_B - x_A back through RATR_A^{\mathsf T} and CTC^{\mathsf T} yields the three translation residuals d=(tx,ty,tz)d = (t_x, t_y, t_z) in metres. In parallel, the relative quaternion qA−1qBq_A^{-1} q_B projected into the site frame CC yields the three dimensionless rotation residuals V=(rx,ry,rz)V = (r_x, r_y, r_z). The joint's kind μ\mu maps each component i∈Ci \in \mathcal{C} to its role: a hard row gi=0g_i = 0 if locked, nothing if free, or a potential term 12gi2/ci\tfrac12 g_i^2 / c_i if spring; axial and plane families instead supply one scalar residual (length using LL, or gap).

Symbol-by-symbol notes
$o$ and $C \in SO(3)$ — site origin and frame

o∈R3o \in \mathbb{R}^3 is the site's world position at design (m), and the columns of C∈SO(3)C \in SO(3) are the site's local x,y,zx, y, z unit axes in world coordinates. By convention the third column (site zz) is the joint axis, so a revolute joint frees rzr_z and a prismatic joint frees tzt_z.

$x\lt em>A, x\lt /em>B$ and $d \in \mathbb{R}^3$ — relative site translation

Because every body frame coincides with the world frame at design, body AA carries oo to xA=pA+RAox_A = p_A + R_A o, and similarly xB=pB+RBox_B = p_B + R_B o. Multiplying xB−xAx_B - x_A by CTRATC^{\mathsf T} R_A^{\mathsf T} expresses the separation in AA's moving copy of the site frame, giving the components (tx,ty,tz)(t_x, t_y, t_z) in metres.

$q\lt em>A, q\lt /em>B$ and $V \in \mathbb{R}^3$ — quaternion rotation residual

qA,qB∈S3q_A, q_B \in S^3 encode the same orientations as RA,RB∈SO(3)R_A, R_B \in SO(3), and qA−1qBq_A^{-1} q_B is the relative rotation of BB from AA by angle ϕ\phi about unit axis u∈S2u \in S^2. Its vector part in the site frame, V=CTvec⁡(qA−1qB)=sin⁡(ϕ/2) CTuV = C^{\mathsf T} \operatorname{vec}(q_A^{-1} q_B) = \sin(\phi/2)\, C^{\mathsf T} u, is dimensionless and polynomial in the unknowns, avoiding trigonometric singularities at ϕ=0\phi = 0.

$\mathcal{C}$ and $\mu$ — component set and kind map

For frame joints C={tx,ty,tz,rx,ry,rz}\mathcal{C} = \{t_x, t_y, t_z, r_x, r_y, r_z\}, while axial has {length}\{\text{length}\} and plane has {gap}\{\text{gap}\}. A kind μ\mu assigns every component in C\mathcal{C} one of locked, free or spring with no implicit defaults, and the body ordering a → b sets the sign of dd and VV.

$g\lt em>i$ and $c\lt /em>i$ — generic residual and spring compliance

gi∈Rg_i \in \mathbb{R} stands for whichever scalar component residual applies (did_i, ViV_i, length error or plane gap), in metres or dimensionless. Compliance ci≥0c_i \ge 0 is the inverse of stiffness (m/N or rad/(N·m)), so a smaller cic_i is stiffer and ci=0c_i = 0 is the rigid limit; do not confuse gig_i here with the geometry vector gg of §2.

$L \in \mathbb{R}_{>0}$ — distance-joint length

An axial distance joint writes one scalar row ∥xB−xA∥−L=0\lVert x_B - x_A \rVert - L = 0 in metres between a point on AA and a point on BB, without introducing an intermediate rigid body.

A site is a named point with axes: an origin oo and a frame CC (columns: the site's x,y,zx, y, z in world). Every body's local frame is the world frame at the design pose, so a joint's site is one point that both bodies share at design, and geometry is written once, in world coordinates, as CAD exports it.

A joint between bodies AA and BB at a site compares where each body puts that site. With poses (pA,RA)(p_A, R_A) and (pB,RB)(p_B, R_B):

xA=pA+RAo,xB=pB+RBo,d=CTRAT(xB−xA).x_A = p_A + R_A o,\qquad x_B = p_B + R_B o,\qquad d = C^{\mathsf T} R_A^{\mathsf T} (x_B - x_A).

dd is BB's displacement from AA at the site, in AA's copy of the site frame: three components tx,ty,tzt_x, t_y, t_z. For the relative rotation, take the quaternion qA−1qBq_A^{-1} q_B. A rotation by ϕ\phi about a unit axis uu is the quaternion (cos⁡ϕ2, sin⁡ϕ2 u)(\cos\tfrac\phi2,\ \sin\tfrac\phi2\, u), so the vector part in the site frame is

V=CTvec⁡(qA−1qB)=sin⁡ϕ2  CTu,V = C^{\mathsf T} \operatorname{vec}(q_A^{-1} q_B) = \sin\tfrac\phi2\; C^{\mathsf T} u,

three more components rx,ry,rzr_x, r_y, r_z. d=0d = 0 and V=0V = 0 mean the two copies of the site coincide and are aligned. VV is a polynomial in the unknowns (no arctan⁡\arctan, no log⁡\log), smooth through ϕ=0\phi = 0.

Each component has a mode. locked writes the row di=0d_i = 0 or Vi=0V_i = 0. free writes nothing: it is a coordinate the mechanism may use, and an actuator may prescribe. spring keeps the same expression gi(q)g_i(q) but puts 12gi2/ci\tfrac12 g_i^2 / c_i into a potential instead of setting gi=0g_i = 0 (compliance cic_i, so c=0c = 0 is the rigid row). The site's zz is the axis: a revolute frees rzr_z, a prismatic frees tzt_z.

A constraint kind is a named bundle of modes, read from examples/constraints.yaml; the package itself knows no kind by name. The library this corner uses:

kind family locked free spring hard rows
spherical frame tx, ty, tz rx, ry, rz — 3
revolute frame tx, ty, tz, rx, ry rz — 5
cylindrical frame tx, ty, rx, ry tz, rz — 4
planar frame tz, rx, ry tx, ty, rz — 3
prismatic frame tx, ty, rx, ry, rz tz — 5
universal frame tx, ty, tz, rx ry, rz — 4
rigid frame tx, ty, tz, rx, ry, rz — — 6
bushed frame — — tx, ty, tz, rx, ry, rz 0
distance axial length — — 1
plane-gap plane gap — — 1

The axial and plane families have one component each: length, the distance between a point on AA and a point on BB, and gap, a point's signed height above a plane.

The corner's joints, and the rows each writes:

joint kind bodies rows
lca-ground revolute ground → lca lca-ground.tx, lca-ground.ty, lca-ground.tz, lca-ground.rx, lca-ground.ry
uca-ground revolute ground → uca uca-ground.tx, uca-ground.ty, uca-ground.tz, uca-ground.rx, uca-ground.ry
lca-up spherical lca → up lca-up.tx, lca-up.ty, lca-up.tz
uca-up spherical uca → up uca-up.tx, uca-up.ty, uca-up.tz
tie-rod distance ground → up tie-rod.length

17 hard rows in all.

An actuator names one free component of one frame joint: lca-drive acts on lca-ground.rz, the lower arm's hinge angle. A rotational actuator needs exactly one free rotation on its joint, because "the angle" is not a single coordinate of a joint free about two axes.

Why the tie rod is a distance, not a body. A rod with a ball joint at each end can spin about its own axis, and nothing resists it. As a fifth body it would add 6 freedoms and 6 rows, and the count becomes 6×4−(2×5+4×3)=26 \times 4 - (2 \times 5 + 4 \times 3) = 2: the wheel's travel plus that idle spin, which no actuator drives, so check would refuse the model. The distance row, ∣xB−xA∣−L=0|x_B - x_A| - L = 0, says only what the rod does: it keeps two points a fixed distance apart.

source: solvers/otkd/examples/constraints.yaml:30-77

The kind library the examples share. Every component must be listed: omission is an error, not a default.

constraint_kinds:
  spherical:
    family: frame
    modes: {tx: locked, ty: locked, tz: locked, rx: free,   ry: free,   rz: free}

  revolute:
    family: frame
    modes: {tx: locked, ty: locked, tz: locked, rx: locked, ry: locked, rz: free}

  cylindrical:
    family: frame
    modes: {tx: locked, ty: locked, tz: free,   rx: locked, ry: locked, rz: free}

  planar:
    family: frame
    modes: {tx: free,   ty: free,   tz: locked, rx: locked, ry: locked, rz: free}

  # Slides along the site's z, which is also the axis a revolute would turn about. A
  # vertical slide for a road body needs a site whose z is up; that is the whole of it.
  prismatic:
    family: frame
    modes: {tx: locked, ty: locked, tz: free,   rx: locked, ry: locked, rz: locked}

  universal:
    family: frame
    modes: {tx: locked, ty: locked, tz: locked, rx: locked, ry: free,   rz: free}

  rigid:
    family: frame
    modes: {tx: locked, ty: locked, tz: locked, rx: locked, ry: locked, rz: locked}

  # Every component compliant: the joint is located and oriented by its bushes. What the
  # book's §4 needs if the compliance is at the inner pivots rather than the tie rod.
  bushed:
    family: frame
    modes: {tx: spring, ty: spring, tz: spring, rx: spring, ry: spring, rz: spring}

  distance:
    family: axial
    modes: {length: locked}

  # A point held a fixed perpendicular distance from a plane: a wheel of radius `gap`
  # touching a road, with the plane at the `from` site and the wheel centre at `to`. Set
  # `gap: spring` for a compliant tyre; that makes the study an equilibrium problem, with
  # the same machinery §4 uses.
  plane-gap:
    family: plane
    modes: {gap: locked}
When the component model of a joint breaks
  • Assumes: every component is exactly locked, free or linearly compliant, in the site's fixed frame
  • When it fails: a joint with play, an end stop, or a coupling such as a screw (dzd_z tied to θz\theta_z) is not a mode map; forced into one it gives a row set that still passes check but describes a different part
  • Check: go through the six components of each joint and ask what the real part allows along each; a coupling needs a new family, not a new kind

4. Unknowns and rows

Setting: the problem, its sets and its symbols

Problem. Given the moving bodies M\mathcal{M} and the corner's joints and actuator, find the unknown vector qq and the row map Φ\Phi (hard, driver, norm and spring rows) such that Φ(q0;g,0)=0\Phi(q_0; g, 0) = 0 at the design pose; then ask which rows qq needs for every solution to be a rigid pose of each body.

Symbol In Meaning
M\mathcal{M} ⊂B\subset \mathcal{B} the moving bodies: lca, uca, up
pbp_b R3\mathbb{R}^3 position of body b∈Mb \in \mathcal{M}, m
qb=(qw,v)q_b = (q_w, v) R4\mathbb{R}^4 quaternion of body bb, v=(qx,qy,qz)v = (q_x, q_y, q_z); a rotation only when ∥qb∥=1\lVert q_b \rVert = 1
R(qb)R(q_b) R3×3\mathbb{R}^{3 \times 3} (qw2−∥v∥2)I+2vvT+2qw[v]×(q_w^2 - \lVert v \rVert^2) I + 2 v v^{\mathsf T} + 2 q_w [v]_\times
qq Rn, n=7∣M∣\mathbb{R}^{n},\ n = 7 \lvert \mathcal{M} \rvert the unknowns: (pb,qb)(p_b, q_b) for each moving body
q0q_0 Rn\mathbb{R}^{n} design pose: pb=0p_b = 0, qb=(1,0,0,0)q_b = (1, 0, 0, 0)
gg Rng\mathbb{R}^{n_g} geometry numbers (§2), held fixed here
θ\theta R\mathbb{R} the drive: lower-arm hinge angle, rad
Φ\Phi Rn→Rr\mathbb{R}^{n} \to \mathbb{R}^{r} rows in otkd's order: joint rows, drivers, norms; m, rad or none
JJ Rr×n\mathbb{R}^{r \times n} ∂Φ/∂q\partial \Phi / \partial q at q0q_0
JcJ_c Rrc×n\mathbb{R}^{r_c \times n} the hard and norm rows of JJ, driver left out
LL R>0\mathbb{R}_{>0} tie-rod length, m
Π\Pi Rn→R\mathbb{R}^{n} \to \mathbb{R} potential of the spring terms and loads, J
How these symbols connect

Each moving body b∈Mb \in \mathcal{M} contributes seven unknowns (pb,qb)∈R3×R4(p_b, q_b) \in \mathbb{R}^3 \times \mathbb{R}^4, stacked into q∈Rnq \in \mathbb{R}^n with n=7∣M∣n = 7 \lvert \mathcal{M} \rvert and known design pose q0q_0. With geometry gg fixed and drive θ\theta applied, Φ(q;g,θ)\Phi(q; g, \theta) collects every non-spring scalar equation in order — joint hard rows (including axial length LL), driver rows and one norm row per moving body — while any spring components and external loads enter the potential Π(q)\Pi(q) in joules. Differentiating Φ\Phi at q0q_0 gives the full Jacobian J∈Rr×nJ \in \mathbb{R}^{r \times n}, and leaving out the driver rows gives the constraint Jacobian Jc∈Rrc×nJ_c \in \mathbb{R}^{r_c \times n}.

Symbol-by-symbol notes
$q\lt em>b = (q\lt /em>w, v)$ versus $q$ — body quaternion and stacked pose

Do not confuse a single body's four-number quaternion qb=(qw,qx,qy,qz)∈R4q_b = (q_w, q_x, q_y, q_z) \in \mathbb{R}^4 with the full unknown vector q∈Rnq \in \mathbb{R}^n stacking (pb,qb)(p_b, q_b) over all moving bodies b∈Mb \in \mathcal{M}. At the design pose q0q_0, every body has pb=0p_b = 0 and qb=(1,0,0,0)q_b = (1, 0, 0, 0) because every body frame matches the world frame at rest.

$R(q_b)$ — polynomial rotation formula

R(qb)=(qw2−∥v∥2)I+2vvT+2qw[v]×R(q_b) = (q_w^2 - \lVert v \rVert^2) I + 2 v v^{\mathsf T} + 2 q_w [v]_\times maps qb∈R4q_b \in \mathbb{R}^4 to a 3×33 \times 3 matrix using polynomials only, so its derivatives are smooth everywhere, including at v=0v = 0. It represents a proper rotation in SO(3)SO(3) only when ∥qb∥=1\lVert q_b \rVert = 1; [v]×[v]_\times is the 3×33 \times 3 skew-symmetric cross-product matrix of vv.

$\Phi$ — row groups and mixed units

Φ\Phi orders its rr scalar rows as hard joint rows (m, or dimensionless for ViV_i), then actuator driver rows (rad or m), then one norm row ∥qb∥2−1=0\lVert q_b \rVert^2 - 1 = 0 (dimensionless) per moving body. Because rows carry different physical units, residuals and tolerances must be read with each row's unit in mind.

$J$ versus $J_c$ — full Jacobian and constraint Jacobian

J=∂Φ/∂q∈Rr×nJ = \partial \Phi / \partial q \in \mathbb{R}^{r \times n} includes the driver rows, whereas Jc∈Rrc×nJ_c \in \mathbb{R}^{r_c \times n} keeps only the hard joint rows and the body norm rows. Omitting the drivers from JcJ_c isolates the freedoms of the unactuated mechanism.

$\Pi(q)$ — elastic and load potential

Π(q)=12∑gi(q)2/ci−∑F⋅x(q)\Pi(q) = \tfrac12 \sum g_i(q)^2 / c_i - \sum F \cdot x(q) has units of joules (N·m) and enters the solve only when the model has spring components or external loads; a purely rigid kinematic model solves Φ=0\Phi = 0 without Π\Pi.

Unknowns. Each moving body has a position pp and a unit quaternion q=(qw,qx,qy,qz)q = (q_w, q_x, q_y, q_z): 7 numbers. The corner has 3 moving bodies, so n=21n = 21. The design pose is exact and known: p=0p = 0, q=(1,0,0,0)q = (1, 0, 0, 0) for every body, because every body's frame is the world frame at design.

Why a quaternion. A rotation vector ω\omega (angle times axis) has three numbers, but R=exp⁡([ω]×)R = \exp([\omega]_\times) has a derivative of the form 0/00/0 at ω=0\omega = 0, and ω=0\omega = 0 is the design pose every model is assembled, checked and first solved at. The quaternion's rotation matrix

R(q)=(qw2−∣v∣2) I+2 vvT+2 qw[v]×,v=(qx,qy,qz),R(q) = (q_w^2 - |v|^2)\, I + 2\, v v^{\mathsf T} + 2\, q_w [v]_\times, \qquad v = (q_x, q_y, q_z),

is a polynomial, so every row and its Jacobian are exact everywhere. The cost is a fourth number for three rotations, and one more row per body, the norm row qw2+qx2+qy2+qz2−1=0q_w^2 + q_x^2 + q_y^2 + q_z^2 - 1 = 0. Whether the joints would pin the fourth number without it is the prediction below.

Rows, one scalar equation each, named <joint>.<component>:

group from expression unit
hard a locked frame component did_i or ViV_i m, or none
hard (axial) a distance joint ∣xB−xA∣−L\lvert x_B - x_A \rvert - L m
hard (plane) a plane-gap joint n⋅(xB−xA)−gn \cdot (x_B - x_A) - g m
driver a position actuator 2atan2⁡(Vi,w)−θ2 \operatorname{atan2}(V_i, w) - \theta, or di−θd_i - \theta rad or m
norm each moving body ∣q∣2−1\lvert q \rvert^2 - 1 none
spring a spring component the same gi(q)g_i(q), entering Π=12∑gi2/ci−∑F⋅x\Pi = \tfrac12 \sum g_i^2 / c_i - \sum F \cdot x m, or none

The driver reads the signed angle about the site axis: near design 2atan2⁡(Vz,w)≈2Vz=2sin⁡θ2≈θ2\operatorname{atan2}(V_z, w) \approx 2 V_z = 2\sin\tfrac\theta2 \approx \theta. It is the only trigonometry in the model.

check on the corner evaluates every row at the design pose (each must be zero to 10−910^{-9}, or the model is not assembled):

row group unit design residual
lca-ground.tx hard m +0.0e+00
lca-ground.ty hard m +0.0e+00
lca-ground.tz hard m +6.1e-18
lca-ground.rx hard — +0.0e+00
lca-ground.ry hard — +0.0e+00
uca-ground.tx hard m +0.0e+00
uca-ground.ty hard m +0.0e+00
uca-ground.tz hard m -6.9e-18
uca-ground.rx hard — +0.0e+00
uca-ground.ry hard — +0.0e+00
lca-up.tx hard m +0.0e+00
lca-up.ty hard m +0.0e+00
lca-up.tz hard m +0.0e+00
uca-up.tx hard m +0.0e+00
uca-up.ty hard m +0.0e+00
uca-up.tz hard m +0.0e+00
tie-rod.length hard m +0.0e+00
lca-ground.rz driver rad +0.0e+00
lca.unit norm — +0.0e+00
uca.unit norm — +0.0e+00
up.unit norm — +0.0e+00

The rows themselves, from otkd.compile in the names otkd compile --format latex prints (PP a design point, CC a site-frame entry, p,qp, q the unknowns, θ\theta the drive). The hinge's locked rotation about its site xx, the driver, and a norm row:

lca-ground.rx:Clca-hinge,11qlca,x+Clca-hinge,21qlca,y+Clca-hinge,31qlca,z=0\texttt{lca-ground.rx}:\quad C_{\text{lca-hinge},11} q_{\text{lca},x} + C_{\text{lca-hinge},21} q_{\text{lca},y} + C_{\text{lca-hinge},31} q_{\text{lca},z} = 0 lca-ground.rz:−θlca-drive+2atan⁡2(Clca-hinge,13qlca,x+Clca-hinge,23qlca,y+Clca-hinge,33qlca,z,qlca,w)=0\texttt{lca-ground.rz}:\quad - \theta_{\text{lca-drive}} + 2 \operatorname{atan}_{2}{\left(C_{\text{lca-hinge},13} q_{\text{lca},x} + C_{\text{lca-hinge},23} q_{\text{lca},y} + C_{\text{lca-hinge},33} q_{\text{lca},z},q_{\text{lca},w} \right)} = 0 up.unit:qup,w2+qup,x2+qup,y2+qup,z2−1=0\texttt{up.unit}:\quad q_{\text{up},w}^{2} + q_{\text{up},x}^{2} + q_{\text{up},y}^{2} + q_{\text{up},z}^{2} - 1 = 0

The ground side has qw=1q_w = 1, v=0v = 0, so VV for a hinge to ground is CTvlcaC^{\mathsf T} v_{\text{lca}}, linear. A translation row between two moving bodies multiplies two rotation matrices and is expanded in full, which is why otkd derives rows and never asks for them by hand. Operation counts of the expanded expressions:

row operations
lca-ground.tx 119
lca-ground.rx 5
uca-ground.tx 119
lca-up.tx 1685
tie-rod.length 437
lca-ground.rz 8
up.unit 8
compile --format latex: lca-ground.tx and tie-rod.length
lca-ground\,tx &: C_{\text{lca-hinge},11} P_{\text{lcaf},x} q_{\text{lca},w}^{2} + C_{\text{lca-hinge},11} P_{\text{lcaf},x} q_{\text{lca},x}^{2} - C_{\text{lca-hinge},11} P_{\text{lcaf},x} q_{\text{lca},y}^{2} - C_{\text{lca-hinge},11} P_{\text{lcaf},x} q_{\text{lca},z}^{2} - C_{\text{lca-hinge},11} P_{\text{lcaf},x} - 2 C_{\text{lca-hinge},11} P_{\text{lcaf},y} q_{\text{lca},w} q_{\text{lca},z} + 2 C_{\text{lca-hinge},11} P_{\text{lcaf},y} q_{\text{lca},x} q_{\text{lca},y} + 2 C_{\text{lca-hinge},11} P_{\text{lcaf},z} q_{\text{lca},w} q_{\text{lca},y} + 2 C_{\text{lca-hinge},11} P_{\text{lcaf},z} q_{\text{lca},x} q_{\text{lca},z} + C_{\text{lca-hinge},11} p_{\text{lca},x} + 2 C_{\text{lca-hinge},21} P_{\text{lcaf},x} q_{\text{lca},w} q_{\text{lca},z} + 2 C_{\text{lca-hinge},21} P_{\text{lcaf},x} q_{\text{lca},x} q_{\text{lca},y} + C_{\text{lca-hinge},21} P_{\text{lcaf},y} q_{\text{lca},w}^{2} - C_{\text{lca-hinge},21} P_{\text{lcaf},y} q_{\text{lca},x}^{2} + C_{\text{lca-hinge},21} P_{\text{lcaf},y} q_{\text{lca},y}^{2} - C_{\text{lca-hinge},21} P_{\text{lcaf},y} q_{\text{lca},z}^{2} - C_{\text{lca-hinge},21} P_{\text{lcaf},y} - 2 C_{\text{lca-hinge},21} P_{\text{lcaf},z} q_{\text{lca},w} q_{\text{lca},x} + 2 C_{\text{lca-hinge},21} P_{\text{lcaf},z} q_{\text{lca},y} q_{\text{lca},z} + C_{\text{lca-hinge},21} p_{\text{lca},y} - 2 C_{\text{lca-hinge},31} P_{\text{lcaf},x} q_{\text{lca},w} q_{\text{lca},y} + 2 C_{\text{lca-hinge},31} P_{\text{lcaf},x} q_{\text{lca},x} q_{\text{lca},z} + 2 C_{\text{lca-hinge},31} P_{\text{lcaf},y} q_{\text{lca},w} q_{\text{lca},x} + 2 C_{\text{lca-hinge},31} P_{\text{lcaf},y} q_{\text{lca},y} q_{\text{lca},z} + C_{\text{lca-hinge},31} P_{\text{lcaf},z} q_{\text{lca},w}^{2} - C_{\text{lca-hinge},31} P_{\text{lcaf},z} q_{\text{lca},x}^{2} - C_{\text{lca-hinge},31} P_{\text{lcaf},z} q_{\text{lca},y}^{2} + C_{\text{lca-hinge},31} P_{\text{lcaf},z} q_{\text{lca},z}^{2} - C_{\text{lca-hinge},31} P_{\text{lcaf},z} + C_{\text{lca-hinge},31} p_{\text{lca},z} = 0
tie-rod\,length &: - L_{\text{tie-rod}} + \sqrt{P_{\text{tri},x}^{2} - 2 P_{\text{tri},x} P_{\text{tro},x} q_{\text{up},w}^{2} - 2 P_{\text{tri},x} P_{\text{tro},x} q_{\text{up},x}^{2} + 2 P_{\text{tri},x} P_{\text{tro},x} q_{\text{up},y}^{2} + 2 P_{\text{tri},x} P_{\text{tro},x} q_{\text{up},z}^{2} + 4 P_{\text{tri},x} P_{\text{tro},y} q_{\text{up},w} q_{\text{up},z} - 4 P_{\text{tri},x} P_{\text{tro},y} q_{\text{up},x} q_{\text{up},y} - 4 P_{\text{tri},x} P_{\text{tro},z} q_{\text{up},w} q_{\text{up},y} - 4 P_{\text{tri},x} P_{\text{tro},z} q_{\text{up},x} q_{\text{up},z} - 2 P_{\text{tri},x} p_{\text{up},x} + P_{\text{tri},y}^{2} - 4 P_{\text{tri},y} P_{\text{tro},x} q_{\text{up},w} q_{\text{up},z} - 4 P_{\text{tri},y} P_{\text{tro},x} q_{\text{up},x} q_{\text{up},y} - 2 P_{\text{tri},y} P_{\text{tro},y} q_{\text{up},w}^{2} + 2 P_{\text{tri},y} P_{\text{tro},y} q_{\text{up},x}^{2} - 2 P_{\text{tri},y} P_{\text{tro},y} q_{\text{up},y}^{2} + 2 P_{\text{tri},y} P_{\text{tro},y} q_{\text{up},z}^{2} + 4 P_{\text{tri},y} P_{\text{tro},z} q_{\text{up},w} q_{\text{up},x} - 4 P_{\text{tri},y} P_{\text{tro},z} q_{\text{up},y} q_{\text{up},z} - 2 P_{\text{tri},y} p_{\text{up},y} + P_{\text{tri},z}^{2} + 4 P_{\text{tri},z} P_{\text{tro},x} q_{\text{up},w} q_{\text{up},y} - 4 P_{\text{tri},z} P_{\text{tro},x} q_{\text{up},x} q_{\text{up},z} - 4 P_{\text{tri},z} P_{\text{tro},y} q_{\text{up},w} q_{\text{up},x} - 4 P_{\text{tri},z} P_{\text{tro},y} q_{\text{up},y} q_{\text{up},z} - 2 P_{\text{tri},z} P_{\text{tro},z} q_{\text{up},w}^{2} + 2 P_{\text{tri},z} P_{\text{tro},z} q_{\text{up},x}^{2} + 2 P_{\text{tri},z} P_{\text{tro},z} q_{\text{up},y}^{2} - 2 P_{\text{tri},z} P_{\text{tro},z} q_{\text{up},z}^{2} - 2 P_{\text{tri},z} p_{\text{up},z} + P_{\text{tro},x}^{2} q_{\text{up},w}^{4} + 2 P_{\text{tro},x}^{2} q_{\text{up},w}^{2} q_{\text{up},x}^{2} + 2 P_{\text{tro},x}^{2} q_{\text{up},w}^{2} q_{\text{up},y}^{2} + 2 P_{\text{tro},x}^{2} q_{\text{up},w}^{2} q_{\text{up},z}^{2} + P_{\text{tro},x}^{2} q_{\text{up},x}^{4} + 2 P_{\text{tro},x}^{2} q_{\text{up},x}^{2} q_{\text{up},y}^{2} + 2 P_{\text{tro},x}^{2} q_{\text{up},x}^{2} q_{\text{up},z}^{2} + P_{\text{tro},x}^{2} q_{\text{up},y}^{4} + 2 P_{\text{tro},x}^{2} q_{\text{up},y}^{2} q_{\text{up},z}^{2} + P_{\text{tro},x}^{2} q_{\text{up},z}^{4} + 2 P_{\text{tro},x} p_{\text{up},x} q_{\text{up},w}^{2} + 2 P_{\text{tro},x} p_{\text{up},x} q_{\text{up},x}^{2} - 2 P_{\text{tro},x} p_{\text{up},x} q_{\text{up},y}^{2} - 2 P_{\text{tro},x} p_{\text{up},x} q_{\text{up},z}^{2} + 4 P_{\text{tro},x} p_{\text{up},y} q_{\text{up},w} q_{\text{up},z} + 4 P_{\text{tro},x} p_{\text{up},y} q_{\text{up},x} q_{\text{up},y} - 4 P_{\text{tro},x} p_{\text{up},z} q_{\text{up},w} q_{\text{up},y} + 4 P_{\text{tro},x} p_{\text{up},z} q_{\text{up},x} q_{\text{up},z} + P_{\text{tro},y}^{2} q_{\text{up},w}^{4} + 2 P_{\text{tro},y}^{2} q_{\text{up},w}^{2} q_{\text{up},x}^{2} + 2 P_{\text{tro},y}^{2} q_{\text{up},w}^{2} q_{\text{up},y}^{2} + 2 P_{\text{tro},y}^{2} q_{\text{up},w}^{2} q_{\text{up},z}^{2} + P_{\text{tro},y}^{2} q_{\text{up},x}^{4} + 2 P_{\text{tro},y}^{2} q_{\text{up},x}^{2} q_{\text{up},y}^{2} + 2 P_{\text{tro},y}^{2} q_{\text{up},x}^{2} q_{\text{up},z}^{2} + P_{\text{tro},y}^{2} q_{\text{up},y}^{4} + 2 P_{\text{tro},y}^{2} q_{\text{up},y}^{2} q_{\text{up},z}^{2} + P_{\text{tro},y}^{2} q_{\text{up},z}^{4} - 4 P_{\text{tro},y} p_{\text{up},x} q_{\text{up},w} q_{\text{up},z} + 4 P_{\text{tro},y} p_{\text{up},x} q_{\text{up},x} q_{\text{up},y} + 2 P_{\text{tro},y} p_{\text{up},y} q_{\text{up},w}^{2} - 2 P_{\text{tro},y} p_{\text{up},y} q_{\text{up},x}^{2} + 2 P_{\text{tro},y} p_{\text{up},y} q_{\text{up},y}^{2} - 2 P_{\text{tro},y} p_{\text{up},y} q_{\text{up},z}^{2} + 4 P_{\text{tro},y} p_{\text{up},z} q_{\text{up},w} q_{\text{up},x} + 4 P_{\text{tro},y} p_{\text{up},z} q_{\text{up},y} q_{\text{up},z} + P_{\text{tro},z}^{2} q_{\text{up},w}^{4} + 2 P_{\text{tro},z}^{2} q_{\text{up},w}^{2} q_{\text{up},x}^{2} + 2 P_{\text{tro},z}^{2} q_{\text{up},w}^{2} q_{\text{up},y}^{2} + 2 P_{\text{tro},z}^{2} q_{\text{up},w}^{2} q_{\text{up},z}^{2} + P_{\text{tro},z}^{2} q_{\text{up},x}^{4} + 2 P_{\text{tro},z}^{2} q_{\text{up},x}^{2} q_{\text{up},y}^{2} + 2 P_{\text{tro},z}^{2} q_{\text{up},x}^{2} q_{\text{up},z}^{2} + P_{\text{tro},z}^{2} q_{\text{up},y}^{4} + 2 P_{\text{tro},z}^{2} q_{\text{up},y}^{2} q_{\text{up},z}^{2} + P_{\text{tro},z}^{2} q_{\text{up},z}^{4} + 4 P_{\text{tro},z} p_{\text{up},x} q_{\text{up},w} q_{\text{up},y} + 4 P_{\text{tro},z} p_{\text{up},x} q_{\text{up},x} q_{\text{up},z} - 4 P_{\text{tro},z} p_{\text{up},y} q_{\text{up},w} q_{\text{up},x} + 4 P_{\text{tro},z} p_{\text{up},y} q_{\text{up},y} q_{\text{up},z} + 2 P_{\text{tro},z} p_{\text{up},z} q_{\text{up},w}^{2} - 2 P_{\text{tro},z} p_{\text{up},z} q_{\text{up},x}^{2} - 2 P_{\text{tro},z} p_{\text{up},z} q_{\text{up},y}^{2} + 2 P_{\text{tro},z} p_{\text{up},z} q_{\text{up},z}^{2} + p_{\text{up},x}^{2} + p_{\text{up},y}^{2} + p_{\text{up},z}^{2}} = 0

The Jacobian at the design pose, 21 rows by 21 unknowns, 92 non-zero entries. Each joint's rows touch only the bodies it joins; rows to ground touch one body. The norm rows touch only qwq_w, with entry 2: at q=(1,0,0,0)q = (1, 0, 0, 0) the derivative of ∣q∣2−1|q|^2 - 1 is 2q2q.

Predict first. Delete the upright's norm row up.unit and keep every other constraint row. The mobility (unknowns minus the rank of the constraint rows) becomes

Choose a prediction

Check answer (without scripting)

Answer: 2: the quaternion's length becomes a free direction. R(q)R(q) is ∣q∣2|q|^2 times a rotation, so a longer qq scales the upright about the origin; the arms can swing to absorb it. One more freedom, rank 19.

Reveal result (lock in your prediction above first)

All 20 constraint rows: rank 20, mobility 1. Drop one norm row at a time:

dropped rank mobility
lca.unit 19 2
uca.unit 19 2
up.unit 19 2

The new free direction (the part of the null space not already there) has its largest entries at up.px (-0.68), up.qw (+0.46), up.pz (-0.33): the upright's quaternion grows while the body shifts and the arms swing. Because R(q)R(q) is homogeneous of degree 2, a non-unit qq gives ∣q∣2|q|^2 times a rotation: a scaling of the upright's points about the world origin. The joint rows fix where three of those points go, not the length of qq, and to first order a scaled, shifted upright with the arms swung to match satisfies them all. The rank finds that without anyone having to see it.

When the quaternion pose breaks
  • Assumes: every moving body has its norm row, and its design frame is the world frame so the seed q=(1,0,0,0)q = (1, 0, 0, 0) is exact
  • When it fails: without the norm row the quaternion's length is a free direction and R(q)R(q) stops being a rotation; a design authored with per-body frames would seed far from the root
  • Check: check lists one <body>.unit row per moving body, and every row's design residual is zero to 10−910^{-9}

5. Counting: Grübler against the rank

Setting: the problem, its sets and its symbols

Problem. Given a model's unknowns q∈Rnq \in \mathbb{R}^n, its constraint rows (hard and norm) with Jacobian JcJ_c at the design pose q0q_0, its driver rows and its aa position actuators, find the mobility M=dim⁡ker⁡JcM = \dim \ker J_c and the redundancy ρ\rho, compare MM with Grübler's count, and decide the solver class.

Symbol In Meaning
NN N\mathbb{N} bodies, the fixed one included
cjc_j N\mathbb{N} constraints joint jj imposes: its locked components
McountM_{\text{count}} Z\mathbb{Z} Grübler's count 6(N−1)−∑jcj6(N - 1) - \sum_j c_j
nn N\mathbb{N} unknowns, 7(N−1)7(N - 1)
rcr_c N\mathbb{N} hard plus norm rows
JcJ_c Rrc×n\mathbb{R}^{r_c \times n} Jacobian of the hard and norm rows at q0q_0, rows in m or none
JJ Rr×n\mathbb{R}^{r \times n} Jacobian of every non-spring row, driver included
σ1≥σ2≥…\sigma_1 \ge \sigma_2 \ge \dots R≥0\mathbb{R}_{\ge 0} singular values of JcJ_c
rank⁡\operatorname{rank} Rr×n→N\mathbb{R}^{r \times n} \to \mathbb{N} number of σi>10−10σ1\sigma_i > 10^{-10} \sigma_1
MM N\mathbb{N} mobility n−rank⁡Jcn - \operatorname{rank} J_c
ρ\rho N\mathbb{N} redundancy: rows of JJ minus rank⁡J\operatorname{rank} J
aa N\mathbb{N} position actuators; check requires M=aM = a
How these symbols connect

From the model's NN bodies (including ground) and its joint constraint counts cjc_j, Grübler's formula produces the integer count Mcount=6(N−1)−∑jcjM_{\text{count}} = 6(N - 1) - \sum_j c_j, which in otkd's coordinates equals n−rcn - r_c because each moving body adds 77 unknowns and 11 norm row. To test linear independence at the design pose q0q_0, otkd takes the SVD of the constraint Jacobian Jc∈Rrc×nJ_c \in \mathbb{R}^{r_c \times n}, counts its singular values above 10−10σ110^{-10} \sigma_1 to get rank⁡Jc\operatorname{rank} J_c, and defines the true mobility M=n−rank⁡JcM = n - \operatorname{rank} J_c, which check compares against the actuator count aa. Including the driver rows gives the full Jacobian J∈Rr×nJ \in \mathbb{R}^{r \times n}, whose excess of rows over rank is the redundancy ρ\rho; together, rank⁡J\operatorname{rank} J, ρ\rho and the presence of springs determine the solver class.

Symbol-by-symbol notes
$N$, $n$ and $r_c$ — translating bodies into matrix dimensions

NN counts all bodies including the fixed ground, so there are N−1N - 1 moving bodies and n=7(N−1)n = 7(N - 1) scalar unknowns. rcr_c counts every hard joint row plus the N−1N - 1 quaternion norm rows, excluding driver rows, so n−rc=6(N−1)−∑jcj=Mcountn - r_c = 6(N - 1) - \sum_j c_j = M_{\text{count}}.

$M_{\text{count}}$ versus $M$ — combinatorial count versus rank mobility

Mcount∈ZM_{\text{count}} \in \mathbb{Z} depends only on how many bodies and locked components are listed (and can be zero or negative), whereas M=n−rank⁡Jc∈NM = n - \operatorname{rank} J_c \in \mathbb{N} measures the dimension of the first-order free-motion space ker⁡Jc\ker J_c at q0q_0. Because rank⁡Jc≤rc\operatorname{rank} J_c \le r_c, McountM_{\text{count}} never exceeds MM.

$\sigma_i$ and $\operatorname{rank}$ — SVD tolerance

The singular values σ1≥σ2≥⋯≥0\sigma_1 \ge \sigma_2 \ge \dots \ge 0 of JcJ_c (or JJ) are ordered largest to smallest, and rank⁡\operatorname{rank} counts those strictly larger than 10−10σ110^{-10} \sigma_1. Comparing the smallest kept singular value with 10−10σ110^{-10} \sigma_1 shows whether the rank decision sits cleanly away from round-off.

$J_c$ versus $J$, and $\rho$ — redundancy with drivers included

JcJ_c omits the driver rows so M=n−rank⁡JcM = n - \operatorname{rank} J_c counts the unactuated freedoms, while JJ includes the aa driver rows so ρ=r−rank⁡J\rho = r - \operatorname{rank} J counts how many equations in the full system are linearly dependent on the rest. A square system has ρ=0\rho = 0 and rank⁡J=n\operatorname{rank} J = n; ρ>0\rho > 0 with rank⁡J=n\operatorname{rank} J = n is redundant.

$a$ — position actuators and the check gate

a∈Na \in \mathbb{N} is the number of prescribed position drivers in the study. otkd.check requires M=aM = a so that the drivers supply exactly the freedoms the mechanism possesses.

The count. Grübler's (Kutzbach's) formula for a spatial mechanism of NN bodies, one fixed, gives each moving body 6 freedoms and subtracts the constraints cjc_j each joint imposes:

Mcount=6(N−1)−∑jcj.M_{\text{count}} = 6(N - 1) - \sum_j c_j.

In otkd's terms each moving body has 7 unknowns and 1 norm row, which is the same 6, so the count is nn minus the hard and norm rows. For the corner: 21−(17+3)=121 - (17 + 3) = 1.

The rank. Write JcJ_c for the Jacobian of the hard and norm rows at the design pose (the driver row left out). Its null space is the set of first-order motions the joints allow, so

mobility=n−rank⁡Jc,redundancy=(rows with the driver)−rank⁡(those rows).\text{mobility} = n - \operatorname{rank} J_c,\qquad \text{redundancy} = (\text{rows with the driver}) - \operatorname{rank}(\text{those rows}).

Since a rank never exceeds the row count, n−rank⁡Jc≥n−rowsn - \operatorname{rank} J_c \ge n - \text{rows}: the count is a lower bound on the mobility, equal to it exactly when the rows are independent. otkd computes the rank from the SVD with a relative tolerance of 10−1010^{-10}, at no cost, because the Jacobian is already symbolic. The corner's 20 singular values of JcJ_c run from 4.053 down to 0.0864: the smallest is 2.1e-02 of the largest, nowhere near the tolerance, so the rank is unambiguous. check then requires mobility to equal the number of position actuators: 1 against 1 here.

Your prediction at the top is answered here.

Reveal result (lock in your prediction above first)

From otkd.check on both models:

model nn constraint rows count rank of JcJ_c mobility redundancy
double-wishbone (hinge) 21 20 1 20 1 0
double-wishbone-two-leg 21 21 0 20 1 1

The two-leg model's count says 0 and its rank says 1. A count would reject the model the chapter exists to explain; the rank reports the truth, one freedom and one spare row. M08 §2 finds which row with the left null space of the SVD.

Change a joint's kind and recount. Each joint offers the library's kinds of the same family that lock a subset of what it locks now, so every row needed is already in the compiled Jacobian; (none) deletes the joint. The rank is recomputed live from otkd's design Jacobian; the verdict applies otkd's rules (config-layer §9, rules 6–7, and problem-mapping §4.1) without re-running check. Try the two-leg model with uca-rear deleted: the count and the rank agree again, because the spare row went with it; then make the hinge model's lower joint spherical and see the actuator refused.

unknowns nn constraint rows count n−n - rows rank of JcJ_c mobility redundancy
21 20 1 20 1 0

otkd: square: Newton.

The solver follows from the rank, never from a flag. At the design pose, with the driver row included:

condition class solve
any spring row equilibrium constrained minimisation of Π\Pi (M08 §3)
rank⁡<n\operatorname{rank} \lt n under refused
rows == rank =n= n square Newton (M08 §1)
rows >> rank =n= n redundant least squares, then the SVD diagnosis (M08 §2)

There is no solver: key. A model that asks for least squares but is not redundant should not be trusted, and one that is redundant and asks for Newton cannot be: its Newton step has no unique solution. A study can only remove rows (drop:), and dropping an independent one is refused as under-determined.

source: `open_textbook.otkd.solvers.system.System.classify` — `solvers/otkd/src/open_textbook/otkd/solvers/system.py:78`

The classification, at the design pose.

def classify(self) -> str:
    """`square`, `redundant`, `under`, or `equilibrium`."""
    if self.springs:
        return "equilibrium"
    rank, _, _ = rank_and_null(self.jacobian(self.problem.q0()), rtol=1e-10)
    n = self.problem.n
    if rank < n:
        return "under"
    return "square" if len(self.constrained) == rank else "redundant"
When counting by rank breaks
  • Assumes: the design pose is a generic configuration, so the rank there is the rank nearby
  • When it fails: at a toggle or a singular pose the Jacobian loses rank: the count shows a freedom the mechanism does not have, or a smallest singular value near the tolerance makes the rank depend on 10−1010^{-10}
  • Check: read the ratio of the smallest to the largest singular value of the constraint rows; far above 10−1010^{-10} the count is safe

Practice

Practice A (steps partly filled). A MacPherson corner has three moving bodies: a lower arm (revolute to the body), an upright (ball joint to the arm), and the strut's piston rod (ball joint to the body at the top mount, cylindrical joint sliding in the upright's tube). A distance row is the tie rod. Unknowns n=7×3=21n = 7 \times 3 = 21; norm rows 33; hard rows 5+3+3+  ?+15 + 3 + 3 + \;? + 1. Enter Grübler's count n−hard−normn - \text{hard} - \text{norm}.

Worked solution

A cylindrical joint locks 4 components (tx,ty,rx,ryt_x, t_y, r_x, r_y), so the hard rows are 5 + 3 + 3 + 4 + 1 = 16, and the count is 21−16−3=221 - 16 - 3 = 2. The second freedom is the piston rod spinning about its own axis inside the tube: a ball joint at the top and a cylindrical joint below leave that spin free. The rank can only raise the count, so check would see at least 2 against one actuator. Real models lock that spin, or treat the strut as a slider row, like the tie rod.

Practice B (with a hint). At full droop otkd's payload puts the wheel centre at wc=(0.760198,0.000668,0.277583)w_c = (0.760198, 0.000668, 0.277583) and the outboard axle point at wco=(0.860179,0.001805,0.276014)w_{co} = (0.860179, 0.001805, 0.276014). Enter the camber in degrees.

Worked solution

wco−wc=(0.099981,0.001137,−0.001569)w_{co} - w_c = (0.099981, 0.001137, -0.001569), length 0.100000, so nz=−0.01569n_z = -0.01569 and camber =arcsin⁡(0.01569)=0.8990°= \arcsin(0.01569) = 0.8990°. The payload's own camber for this frame is 0.8992°; the 0.0002° between them is the rounding of the exported points to a micrometre.

Hint 1

Form n=(wco−wc)/∣wco−wc∣n = (w_{co} - w_c) / |w_{co} - w_c|; only nzn_z matters for camber.

Hint 2

camber =arcsin⁡(−nz)= \arcsin(-n_z), converted to degrees. The outboard end dips, so expect a positive answer.

Practice C (on your own). The lower arm has turned 0.1 rad about its hinge. Enter the vector-part component VzV_z that the hinge's rows see.

Worked solution

V=sin⁡θ2 uV = \sin\tfrac\theta2\, u in the site frame, with u=(0,0,1)u = (0, 0, 1) for a hinge about its site zz: Vz=sin⁡0.05=0.04998V_z = \sin 0.05 = 0.04998, and w=cos⁡0.05w = \cos 0.05. The driver row reads 2atan2⁡(Vz,w)=0.12\operatorname{atan2}(V_z, w) = 0.1 exactly; the small-angle reading 2Vz2V_z would give 0.09996.

Mixed practice: which method, and why?

1. The two-leg corner with all 22 rows kept, solved across the sweep. Which method, and why?

Question 1

2. Before solving anything, you must know whether a new topology moves with exactly one freedom. Which method, and why?

Question 2

3. The upper ball joint becomes bushed, and the wheel centre carries 3500 N. Which method, and why?

Question 3

4. The quarter car's body-bounce and wheel-hop frequencies. Which method, and why?

Question 4

Show answers and explanations

1. Least squares, then the SVD to name the spare row. Rows exceed rank, and rank equals nn: consistent but redundant. Gauss–Newton finds the exact pose; the left null space names the row (M03, M08 §2).

2. The rank of the design Jacobian from its SVD, with a relative tolerance. Mobility is n−rank⁡Jcn - \operatorname{rank} J_c, and the singular values show how safely the rank can be read (M03).

3. Stationarity of the potential under the hard rows: a KKT system. A spring component enters Π\Pi, the hard rows stay constraints, and the equilibrium is a saddle point in (q,λ)(q, \lambda) (M04, M08 §3).

4. The symmetric generalised eigenproblem for stiffness and mass. Kx=ω2MxKx = \omega^2 M x with KK symmetric and MM positive definite: real frequencies and orthogonal modes (M05).

Check yourself (closed book)

1. The two-leg corner has 21 unknowns and 21 constraint rows (18 hard, 3 norm), so Grübler's count gives mobility 0. What is its mobility?

Question 1
How sure?

2. Why does otkd add the row qw2+qx2+qy2+qz2−1=0q_w^2 + q_x^2 + q_y^2 + q_z^2 - 1 = 0 for every moving body?

Question 2
How sure?

3. A spherical joint locks tx,ty,tzt_x, t_y, t_z and frees rx,ry,rzr_x, r_y, r_z. How many rows does it write?

Question 3
How sure?

4. otkd has no solver: key. What decides whether a kinematic study is solved by Newton or by least squares?

Question 4
How sure?

5. You move the lower ball joint 5 mm outboard. Which file changes, and what does otkd derive again?

Question 5
How sure?

6. Why may an actuator not drive a rotation of a spherical joint?

Question 6
How sure?

Show answers and explanations

1. 1, because one row depends on the others. The rank of the 21 constraint rows is 20, so mobility =n−rank=1= n - \text{rank} = 1 and one row is redundant. The count only bounds the mobility from below.

2. Four numbers describe three rotations, and the row removes the spare one. R(q)R(q) is ∣q∣2|q|^2 times a rotation, so without the row the body may grow or shrink. Drop one norm row from the corner and the rank falls by one: mobility 2.

3. Three: one for each locked translation. Each locked component is one row di=0d_i = 0 in the site frame. The free rotations are coordinates the mechanism may use, not equations.

4. The rank of the Jacobian at the design pose, against n and the row count. Rows == rank =n= n is square: Newton. Rows >> rank =n= n is redundant: least squares and a diagnosis. Rank <n\lt n is refused.

5. geometry.yaml only, and nothing: the rows take the numbers as arguments. Coordinates are symbols in the compiled rows, so a new geometry is a new argument vector. The derivation is keyed on topology and kinds, which did not change.

6. Its three rotations are all free, so there is no single angle to prescribe. A rotational driver reads the angle about one site axis. With three free rotations that is not a coordinate of the joint, so otkd requires exactly one.

Keep these:

  1. Camber is arcsin⁡(−nz)\arcsin(-n_z) for the axle's outboard unit vector: positive when the top of the wheel leans out. Toe is the change of the axle's heading, positive in.
  2. Topology says what is joined to what and holds no numbers; geometry holds every number; the study is the question; the kinds are a library. One derivation per topology.
  3. A joint is six components in its site frame, each locked (a row), free (nothing) or spring (a potential term). A kind is a named bundle of those modes.
  4. Each moving body is seven unknowns, position and unit quaternion, and one norm row; without it the quaternion's length is a free direction.
  5. Mobility is n−rank⁡Jcn - \operatorname{rank} J_c; Grübler's count is a lower bound that misses dependent rows. otkd picks its solver from the rank, never from a flag.

Your connection

Pick a mechanism you know (a bicycle's rear suspension, a folding chair, a desk lamp). Name its bodies and joints, write each joint as locked and free components, and count. Where might the count and the rank disagree?

Answers

Practice A. 4 rows for the cylindrical joint, 16 hard rows, count 21−16−3=221 - 16 - 3 = 2: the travel plus the piston rod's spin.

Practice B. about +0.899°+0.899°, top of the wheel out at full droop.

Practice C. Vz=sin⁡0.05≈0.04998V_z = \sin 0.05 \approx 0.04998.

Mixed practice. least squares and the SVD; the rank from the SVD; the KKT system; the generalised eigenproblem.

Where the maths is derived

Optional. These notes give the intuition and application; the sources below give the full derivations and proofs.

§1 The question, the parts, and the two angles

§2 Three files and a library

§3 Bodies, sites, and a joint as six components

§4 Unknowns and rows

§5 Counting: Grübler against the rank


Compiled from notebooks/suspension/s01_corner_as_a_model.py — run locally with cd notebooks && uv run marimo edit suspension/s01_corner_as_a_model.py for live Python scratch cells.

Back to the book: 1.1 The question · Chapter 1 Review

Settings

Colour scheme

Light or dark pages. Your colour and layout stay the same.

Colour

The paper, ink and lettering. Your layout stays the same.

Quiet colours
Bold colours
Reading offline

Keep this book on this device and read it offline.