Maths Applied1.3

All books

S03 — Two legs, one contradiction

Replace the upper wishbone's hinge by two ball-jointed legs and otkd's corner has 22 rows for 21 unknowns. If the rows agree, least squares returns the same pose as the square model. If one hardpoint is out, no pose satisfies every row, and least squares still returns a pose. This notebook measures the difference between those two cases on otkd's double-wishbone-two-leg model, and asks what the compromise pose is worth.

Book pages: 1.3 Two legs, one contradiction and its deeper page What least squares is minimising in books/maths-applied. Design: solvers/otkd/docs/problem-mapping.md §6 (the solvers) and §8 (the row tables). Every solver number here is otkd's, run live and cached.

The question. When least squares returns a pose for a model with more rows than unknowns, is that pose right, or only the smallest misfit the rows allow? And how would you tell?

By the end you can:

  • count rows, rank and redundancy, and read which rows depend on each other off the left null vector
  • say what least squares minimises, how Gauss–Newton and otkd's trust-region solve minimise it, and what their stopping test certifies
  • tell a consistent redundancy from a contradiction by the residual floor, and predict the floor per millimetre of error as ∣uTe∣|u^{\mathsf T} e|
  • explain why weights and units decide a contradicted answer and change nothing in a consistent one
  • decide when a least-squares pose is right and when it is merely small

Assumes: M03 §5–6 (normal equations, QR, the SVD), M04 §5 (Gauss–Newton) and M08 §2 (the two-leg corner's counts).

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: the frame's bracket for the upper arm's rear leg is welded 1 mm aft of the drawing; the arm itself is to drawing. Least squares returns a pose for the two-leg corner. What does its residual look like?

Choose a prediction

Check answer (without scripting)

Answer: shared: about half a millimetre in each leg, with no dependent row met. The front and rear legs' fore-aft rows each keep about 0.49 mm, with opposite signs, and the upper arm's quaternion norm takes a small share. The compromise satisfies none of the dependent rows.

Warm-up: remember

1. Newton on the two-circle system ∣D−B∣2=RB2|D - B|^2 = R_B^2, ∣D−C∣2=L2|D - C|^2 = L^2. Which root it reaches is decided by

Question 1
How sure?

2. 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 2
How sure?

3. A Monte Carlo estimate has a standard error of 0.030.03. To bring it to 0.0030.003 you need

Question 3
How sure?

Show answers and explanations

1. which side of the line BC the start lies on. f1−f2f_1 - f_2 is linear, so the first step lands on the chord line, and the coordinate across BCBC keeps its sign every step after. The basins are two half-planes.

2. 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.

3. 100 times the samples. σ/N\sigma/\sqrt{N} divided by 10 needs N\sqrt N multiplied by 10, so NN by 100: one more digit costs a hundredfold.

1. Two legs, twenty-two rows

Setting: the problem, its sets and its symbols

Problem. Given the two-leg corner's geometry gg and drive θ\theta, the constraint map Φ(⋅ ;g,θ):Rn→Rm\Phi(\cdot\,; g, \theta): \mathbb{R}^n \to \mathbb{R}^m and its Jacobian JJ at a solved pose, find rank⁡J\operatorname{rank} J, the redundancy m−rank⁡Jm - \operatorname{rank} J, and a unit vector u∈Rmu \in \mathbb{R}^m with uTJ=0u^{\mathsf T} J = 0; read which rows uu links and why.

Symbol In Meaning
BB {lca,uca,up}\{\mathrm{lca}, \mathrm{uca}, \mathrm{up}\} the moving bodies; the ground is fixed
qq Rn, n=7⋅3\mathbb{R}^{n},\ n = 7 \cdot 3 the unknowns: per body a position (m) and a quaternion (w,x,y,z)(w, x, y, z) (dimensionless)
gg Rmg\mathbb{R}^{m_g} the data: hardpoint coordinates (m), site frames (dimensionless), the tie-rod length (m)
θ\theta R\mathbb{R} the drive: the lower arm's angle (rad)
II {1,…,m}\{1, \dots, m\} the row index set, m=22m = 22: joint rows (m or dimensionless), one driver row (rad), one norm row per body (dimensionless)
Φ\Phi Rn→Rm\mathbb{R}^{n} \to \mathbb{R}^{m} the constraint map; r=Φ(q)r = \Phi(q) is the residual, in each row's own unit
JJ Rm×n\mathbb{R}^{m \times n} the Jacobian ∂Φ/∂q\partial \Phi / \partial q, exact (otkd differentiates symbolically)
UΣVTU \Sigma V^{\mathsf T} Rm×m×Rm×n×Rn×n\mathbb{R}^{m \times m} \times \mathbb{R}^{m \times n} \times \mathbb{R}^{n \times n} the SVD of JJ; UU, VV orthogonal, Σ\Sigma the singular values
uu Rm, ∥u∥=1\mathbb{R}^{m},\ \lVert u \rVert = 1 a left null vector, uTJ=0u^{\mathsf T} J = 0: a combination of rows that vanishes (dimensionless weights)
aa R3, ∥a∥=1\mathbb{R}^{3},\ \lVert a \rVert = 1 the upper arm's axis, from ucaf to ucar (dimensionless)
R(q)R(q) R3×3\mathbb{R}^{3 \times 3} otkd's rotation matrix, quadratic in the quaternion
D, B1, B2, CD,\ B_1,\ B_2,\ C R2\mathbb{R}^{2} the book's planar sketch: upper ball joint, the two leg pivots, the lower ball joint (m)
How these symbols connect

Fixing the geometry gg and drive angle θ\theta defines the constraint map Φ(⋅ ;g,θ):R21→R22\Phi(\cdot\,; g, \theta): \mathbb{R}^{21} \to \mathbb{R}^{22} across the three moving bodies BB, mapping a pose qq to a residual vector rr in mixed row units. Differentiating Φ\Phi symbolically at a solved pose gives the 22×2122 \times 21 Jacobian JJ, whose SVD J=UΣVTJ = U \Sigma V^{\mathsf T} determines rank⁡J\operatorname{rank} J and any unit left null vector uu satisfying uTJ=0u^{\mathsf T} J = 0. The non-zero entries of uu index the linearly dependent rows in II, which we interpret geometrically through the upper arm's axis aa and otkd's rotation matrix R(q)R(q).

Symbol-by-symbol notes
$q \in \mathbb{R}^{21}$ and moving bodies $B$

Each body in B={lca,uca,up}B = \{\mathrm{lca}, \mathrm{uca}, \mathrm{up}\} contributes seven unknowns: three world-frame position coordinates in metres and a dimensionless quaternion (w,x,y,z)(w, x, y, z). The ground is fixed and carries no unknowns.

$\Phi$ and row units on $I$

The m=22m = 22 rows in II carry mixed units: joint translations and the tie-rod length are in metres, the single driver row is in radians, and joint orientation rows plus the three quaternion-norm rows are dimensionless. Entry (i,j)(i, j) of J=∂Φ/∂qJ = \partial\Phi/\partial q therefore has row ii's unit divided by unknown jj's unit.

$U \Sigma V^{\mathsf T}$ and $u$

For the tall Jacobian J∈R22×21J \in \mathbb{R}^{22 \times 21}, UU is 22×2222 \times 22, VV is 21×2121 \times 21, and Σ\Sigma holds min⁡(m,n)=21\min(m, n) = 21 singular values. A left null vector u∈R22u \in \mathbb{R}^{22} (uTJ=0u^{\mathsf T} J = 0) is a unit vector of dimensionless row weights, distinct from a right null vector v∈R21v \in \mathbb{R}^{21} (Jv=0J v = 0), which describes a free pose motion.

$R(q)$ and quaternion scaling

Here R(q)∈R3×3R(q) \in \mathbb{R}^{3 \times 3} refers to one body's rotation matrix built from its four quaternion components, not the full 21-coordinate vector. Because otkd writes R(q)R(q) as a quadratic polynomial in the quaternion without dividing by ∣q∣2\lvert q \rvert^2, any departure from unit norm scales lengths on that body by ∣q∣2\lvert q \rvert^2.

$D, B\lt em>1, B\lt /em>2, C$ vs the 3D corner

These four points belong only to the book's two-dimensional front-view sketch (metres in R2\mathbb{R}^2), used to introduce the two-leg geometry before switching to otkd's three-dimensional bodies BB and 21-coordinate pose qq.

The book starts in the plane. The upper ball joint DD is two unknowns, and three facts pin it: the front leg keeps its length, the rear leg keeps its length, the upright keeps its length. Three equations, two unknowns. Seen from the front, the two legs lie almost along the line of sight, so their two circles are the same circle: one fact written twice.

otkd keeps all three dimensions. Its double-wishbone-two-leg model replaces the upper arm's hinge by two spherical joints, uca-front at ucaf and uca-rear at ucar, which are 200.2 mm apart. Seven pose coordinates per moving body give n=21n = 21 unknowns; the rows are the joints, one driver row (the lower arm's angle, in radians) and one quaternion norm per body. check reports:

unknowns rows rank of the constraint rows rank of all rows redundancy mobility
21 22 20 21 1 1

A body held at two points can still turn about the line through them, so the second leg adds three rows but only two restrictions. Rows exceed rank by one: one row is a combination of the others. The SVD names the combination (M03 §6, M08 §2). With J=UΣVTJ = U\Sigma V^{\mathsf T}, the last column uu of UU satisfies uTJ=0u^{\mathsf T} J = 0, and its non-zero weights at the solved pose are:

row unit weight in u
uca-front.ty m -0.6992
uca-front.tz m -0.0350
uca-rear.ty m +0.6992
uca-rear.tz m +0.0350
uca.unit — +0.1402

Read it as an identity. The arm's two pivots are a fixed distance apart, so moving the rear pivot along the arm's axis aa must be matched by the front pivot, unless the arm itself changes size. uu's weights on the front and rear yy and zz rows are ∓\mp the axis direction, a≈(0.000,−0.999,−0.050)a \approx (0.000, -0.999, -0.050), scaled; the xx rows carry nothing because the axis has no xx component. The arm's size enters through its quaternion: otkd's rotation matrix R(q)R(q) is quadratic in qq, so it scales lengths by ∣q∣2|q|^2, and the norm row uca.unit is the fifth member. The driver row and every other row have weight zero: only these five rows can disagree with each other. The smallest singular value is 0.088, far from zero: the redundancy is not in the singular values at all.

source: solvers/otkd/examples/double-wishbone-two-leg/topology.yaml:20-30

The two legs, as otkd reads them.

  tri: {origin: tri}
  tro: {origin: tro}

joints:
  - {name: lca-ground, kind: revolute, a: ground, b: lca, site: lca-hinge}
  # two sphericals pin two points of one rigid body: six rows, five independent
  - {name: uca-front, kind: spherical, a: ground, b: uca, site: ucaf}
  - {name: uca-rear, kind: spherical, a: ground, b: uca, site: ucar}
  - {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}

2. What least squares minimises, and how otkd minimises it

Setting: the problem, its sets and its symbols

Problem. Given Φ:Rn→Rm\Phi: \mathbb{R}^n \to \mathbb{R}^m with m>nm > n and a start q0q_0, find q∗∈arg⁡min⁡q∈RnS(q)q^* \in \arg\min_{q \in \mathbb{R}^n} S(q) by iterates qk+1=qk+Δkq_{k+1} = q_k + \Delta_k, with Δk\Delta_k the Gauss–Newton step or the trust-region step; say what each stopping test certifies.

Symbol In Meaning
q, qk, q∗q,\ q_k,\ q^* Rn, n=21\mathbb{R}^{n},\ n = 21 the unknowns, the kk-th iterate, a minimiser: positions (m) and quaternions
Φ, r\Phi,\ r Rn→Rm, m=22\mathbb{R}^{n} \to \mathbb{R}^{m},\ m = 22 the rows and the residual r=Φ(q)r = \Phi(q), in mixed units (m, rad, dimensionless)
JJ Rm×n\mathbb{R}^{m \times n} the Jacobian ∂Φ/∂q\partial \Phi / \partial q
SS Rn→[0,∞)\mathbb{R}^{n} \to [0, \infty) the objective 12∥r∥2\tfrac12 \lVert r \rVert^2
∇S, ∇2S\nabla S,\ \nabla^2 S Rn, Rn×n\mathbb{R}^{n},\ \mathbb{R}^{n \times n} its gradient and Hessian
Δk\Delta_k Rn\mathbb{R}^{n} the step at iterate kk
ρk\rho_k (0,∞)(0, \infty) the trust-region radius, in the scaled variables
DD Rn×n\mathbb{R}^{n \times n} SciPy's diagonal scaling of the variables
θ\theta {0.02,0.04,…,0.2}\{0.02, 0.04, \dots, 0.2\} the drive the slider sets (rad); q0q_0 is the design pose
κ(⋅)\kappa(\cdot) [1,∞)[1, \infty) the 2-norm condition number of a matrix
ϵ\epsilon R>0\mathbb{R}_{>0} machine epsilon for doubles, 2−522^{-52}
How these symbols connect

At a drive angle θ\theta chosen on the slider, the constraint map Φ\Phi turns each iterate qkq_k (starting from the design pose q0q_0) into a 22-row residual r=Φ(qk)r = \Phi(q_k) and the scalar objective S(q)=12∥r∥2S(q) = \tfrac12 \lVert r \rVert^2. Linearising rr with JJ produces the update qk+1=qk+Δkq_{k+1} = q_k + \Delta_k: Gauss–Newton solves an unconstrained linear least-squares step from JJ and rr, whereas otkd's trust-region method restricts that step to the scaled ball ∥DΔk∥≤ρk\lVert D \Delta_k \rVert \le \rho_k. Convergence and accuracy depend on κ(J)\kappa(J), κ(JTJ)\kappa(J^{\mathsf T} J), machine epsilon ϵ\epsilon, and whether stopping checks ∇S≈0\nabla S \approx 0 or r≈0r \approx 0.

Symbol-by-symbol notes
$S(q)$ and mixed row units

Because r=Φ(q)r = \Phi(q) combines metres, radians, and dimensionless entries without weighting, ∥r∥2=∑iri2\lVert r \rVert^2 = \sum_i r_i^2 sums squares numerically in those raw units. The factor 12\tfrac12 keeps the gradient tidy as ∇S=JTr\nabla S = J^{\mathsf T} r.

$\nabla S$ and $\nabla^2 S$

The gradient ∇S=JTr∈R21\nabla S = J^{\mathsf T} r \in \mathbb{R}^{21} vanishes at any stationary point of SS, whether or not r=0r = 0. The full Hessian ∇2S=JTJ+∑iri∇2ri\nabla^2 S = J^{\mathsf T} J + \sum_i r_i \nabla^2 r_i includes a second-derivative sum weighted by rir_i that Gauss–Newton omits.

$\Delta\lt em>k$, $D$, and $\rho\lt /em>k$

The step Δk∈R21\Delta_k \in \mathbb{R}^{21} shares the mixed units of qq (metres for positions, dimensionless for quaternions). SciPy's diagonal matrix DD rescales those variables before enforcing ∥DΔk∥≤ρk\lVert D \Delta_k \rVert \le \rho_k, so the radius ρk>0\rho_k > 0 is measured in the scaled coordinates rather than raw metres.

$\kappa(\cdot)$ for $J$ vs $J^{\mathsf T} J$

For a full-column-rank matrix JJ, the 2-norm condition number is κ(J)=σ1/σn≥1\kappa(J) = \sigma_1 / \sigma_n \ge 1. Forming the normal-equations matrix squares it, κ(JTJ)=κ(J)2\kappa(J^{\mathsf T} J) = \kappa(J)^2, magnifying rounding errors of size ϵ\epsilon in the linear step.

$\theta$ and start pose $q_0$

Each slider value θ∈{0.02,0.04,…,0.2}\theta \in \{0.02, 0.04, \dots, 0.2\} rad defines a fresh drive target, while every curve starts from the same design pose q0q_0 (where θ=0\theta = 0).

Given rows r(q)∈R22r(q) \in \mathbb R^{22}, least squares minimises

S(q)=12∥r(q)∥2,∇S=JTr,∇2S=JTJ+∑iri ∇2ri.S(q) = \tfrac12 \|r(q)\|^2, \qquad \nabla S = J^{\mathsf T} r, \qquad \nabla^2 S = J^{\mathsf T} J + \sum_i r_i\, \nabla^2 r_i .

Gauss–Newton (M04 §5) drops the second term of the Hessian, which needs second derivatives of every row. The Newton step on SS becomes JTJ Δ=−JTrJ^{\mathsf T} J\,\Delta = -J^{\mathsf T} r: exactly the normal equations of the linear problem min⁡Δ∥r+JΔ∥\min_\Delta \|r + J\Delta\|. So each step is a linear least-squares solve, and M03 §5 says how to do it: by QR, because κ(JTJ)=κ(J)2\kappa(J^{\mathsf T} J) = \kappa(J)^2. The dropped term is weighted by rir_i, so when the rows can all be met it vanishes at the answer and Gauss–Newton converges like Newton.

otkd's solver hands rr to SciPy's least_squares(method="trf"), a trust-region method. Each step minimises ∥r+JΔ∥2\|r + J\Delta\|^2 only within ∥DΔ∥≤ρk\|D\Delta\| \le \rho_k, with DD a scaling of the variables. If the actual fall in SS matches the model's prediction, ρ\rho grows and the step becomes the Gauss–Newton step; if not, ρ\rho shrinks and the step turns towards steepest descent. "Reflective" refers to how it handles bounds; otkd sets none. SciPy stops when the gradient, the step or the fall in SS is below tolerance. None of those tests asks for r=0r = 0. otkd adds that check afterwards: it raises unless ∥r∥∞≤10−8\|r\|_\infty \le 10^{-8}.

Move the drive angle. Each curve starts at the design pose, where only the driver row is wrong.

01.534.5610⁻¹⁶10⁻¹²10⁻⁸10⁻⁴otkd trfGN, QRGN, normal eqsiterationmax |r|
θ (rad) otkd evaluations (SciPy's count) otkd residual calls (all) κ(J)\kappa(J) κ(JTJ)\kappa(J^{\mathsf T}J) final cost
0.10 5 116 46.8 2187 1.1e-31

All three reach round-off, and the correct digits roughly double each step: a zero-residual problem, so Gauss–Newton is quadratic. The normal equations lose about 1.7 more digits in each step's direction than QR, and the next step corrects them; with κ(J)\kappa(J) near 47 that costs nothing visible.

otkd passes no Jacobian, so SciPy differences the residual: one call per unknown for every Jacobian, which is why the calls outnumber SciPy's own count. A forward difference with SciPy's default step differs from otkd's exact symbolic JJ by 3.5e-08 relative to its largest entry at θ = 0.1, and the iteration still reaches round-off: an approximate Jacobian slows convergence, the exact residual decides where it ends.

source: `open_textbook.otkd.solvers.least_squares.least_squares` — `solvers/otkd/src/open_textbook/otkd/solvers/least_squares.py:12`

otkd's least squares: SciPy's trust region, no Jacobian passed, and its own refusal of any floor.

def least_squares(
    system: System,
    q0: np.ndarray,
    *,
    rows: list[int] | None = None,
    tol: float = 1e-12,
    max_steps: int = 200,
) -> tuple[np.ndarray, int, list[tuple[np.ndarray, np.ndarray]], float]:
    """Solve the over-determined system. Returns the solution, evaluations, history, cost."""
    history: list[tuple[np.ndarray, np.ndarray]] = []

    def residual(x: np.ndarray) -> np.ndarray:
        return system.residual(x, rows)

    def record(x: np.ndarray) -> None:
        history.append((np.asarray(x).copy(), residual(x).copy()))

    x0 = np.asarray(q0, dtype=float)
    record(x0)
    result = scipy_least_squares(
        residual,
        x0,
        method="trf",
        ftol=tol,
        xtol=tol,
        gtol=tol,
        max_nfev=max_steps * (system.problem.n + 1),
        callback=record,
    )
    record(result.x)
    if float(np.max(np.abs(result.fun))) > 1e-8:
        raise SolverError(
            f"least squares did not converge: {result.message}",
            residual=float(np.max(np.abs(result.fun))),
        )
    return result.x, int(result.nfev), history, float(result.cost)
When Gauss–Newton and the trust region breaks
  • Assumes: the residual at the answer is small, so the neglected ∑ri∇2ri\sum r_i \nabla^2 r_i is too
  • When it fails: with a large floor the step is wrong in the curvature and convergence is linear, or the trust region shrinks step after step; a rank-deficient JJ makes the step itself undefined
  • Check: watch ∥JTr∥\|J^{\mathsf T} r\| and ∥r∥\|r\| separately: the first must fall to round-off, the second tells you whether the rows agree

3. A consistent redundancy, and a contradiction

Setting: the problem, its sets and its symbols

Problem. Given the consistent rows Φ\Phi at θ=0.1\theta = 0.1 rad, their solution q∗q^*, and an error δ\delta in the frame's rear pivot only, find qδ∗∈arg⁡min⁡q12∥rδ(q)∥2q^*_\delta \in \arg\min_q \tfrac12 \lVert r_\delta(q) \rVert^2, the floor ∥rδ(qδ∗)∥\lVert r_\delta(q^*_\delta) \rVert as a function of δ\delta, and the change of pose and camber from q∗q^*. First, as a control, the same question for a moved shared point.

Symbol In Meaning
q, q∗q,\ q^* Rn, n=21\mathbb{R}^{n},\ n = 21 the unknowns and the consistent least-squares pose
Φ\Phi Rn→Rm, m=22\mathbb{R}^{n} \to \mathbb{R}^{m},\ m = 22 the rows (m, rad, dimensionless), with Jacobian JJ
uu Rm\mathbb{R}^{m} the unit left null vector of JJ at q∗q^* (§1)
A, BA,\ B {ground}∪{lca,uca,up}\{\mathrm{ground}\} \cup \{\mathrm{lca}, \mathrm{uca}, \mathrm{up}\} the two bodies a joint connects
pA, RAp_A,\ R_A R3, R3×3\mathbb{R}^{3},\ \mathbb{R}^{3 \times 3} body AA's position (m) and rotation; the ground has p=0p = 0, R=IR = I
oo R3\mathbb{R}^{3} a joint's site origin, from the geometry (m)
CC R3×3\mathbb{R}^{3 \times 3} the site's frame (dimensionless)
dd R3\mathbb{R}^{3} a spherical joint's three rows: the relative displacement of the bodies' attachment points, in the site frame (m)
δ\delta [−2,2] mm along one axis[-2, 2]\ \text{mm along one axis} the error of the frame's pivot of uca-rear; the arm's attachment is unchanged
IrI_r ⊂{1,…,m}\subset \{1, \dots, m\} the three uca-rear rows
ee Rm\mathbb{R}^{m} the shift of the residual: −δ-\delta on IrI_r, zero elsewhere (m)
rδr_\delta Rn→Rm\mathbb{R}^{n} \to \mathbb{R}^{m} the contradicted residual Φ(q)+e\Phi(q) + e
qδ∗q^*_\delta Rn\mathbb{R}^{n} its least-squares pose
γ\gamma (−90,90)(-90, 90) camber (deg), from the axle wc to wco
How these symbols connect

Starting from the consistent rows Φ\Phi and their solved pose q∗q^* at θ=0.1\theta = 0.1 rad, each spherical joint links two bodies AA and BB via their poses (pA,RA)(p_A, R_A), (pB,RB)(p_B, R_B) and site data (o,C)(o, C) to form three displacement rows dd in metres. Displacing only the frame's pivot of uca-rear by δ\delta adds a constant offset ee supported on the three rows IrI_r, turning Φ(q)\Phi(q) into the perturbed residual rδ(q)=Φ(q)+er_\delta(q) = \Phi(q) + e. Minimising 12∥rδ(q)∥2\tfrac12 \lVert r_\delta(q) \rVert^2 yields qδ∗q^*_\delta, whose residual floor ∥rδ(qδ∗)∥\lVert r_\delta(q^*_\delta) \rVert, point shifts, and camber γ\gamma we compare against q∗q^* alongside the left null vector uu from §1.

Symbol-by-symbol notes
$A, B$, $(p\lt em>A, R\lt /em>A)$, and site $(o, C)$

Each joint connects an ordered pair of bodies AA and BB, with the fixed ground given p=0p = 0 and R=IR = I. The site origin o∈R3o \in \mathbb{R}^3 (metres) locates the joint in the geometry, and the orthogonal frame C∈R3×3C \in \mathbb{R}^{3 \times 3} sets the axes in which the displacement dd is measured.

$\delta$, $I_r$, and $e$

The error δ∈[−2,2]\delta \in [-2, 2] mm shifts the frame's pivot of uca-rear along one chosen axis while leaving the arm's attachment unchanged. In metres, e∈R22e \in \mathbb{R}^{22} places −δ-\delta on the matching row of IrI_r (uca-rear.tx, .ty, .tz) and zero on all other 19 rows.

$r\lt em>\delta$ vs $\Phi$, and $q^*\lt /em>\delta$ vs $q^*$

Adding the constant vector ee shifts the residual map to rδ(q)=Φ(q)+er_\delta(q) = \Phi(q) + e while leaving the Jacobian ∂rδ/∂q=J\partial r_\delta / \partial q = J unchanged. Keep q∗q^* (the consistent solution of Φ(q)=0\Phi(q) = 0) distinct from qδ∗q^*_\delta (the least-squares minimiser of 12∥rδ(q)∥2\tfrac12 \lVert r_\delta(q) \rVert^2).

Units of $\lVert r\lt em>\delta(q^*\lt /em>\delta) \rVert$

Because rδr_\delta mixes metres, radians, and dimensionless rows, the unweighted Euclidean norm ∥rδ∥\lVert r_\delta \rVert combines those units into one scalar; the charts display entries scaled by 10310^3 (millimetres for translation rows, 10−310^{-3} for dimensionless rows).

Camber $\gamma$

Computed in degrees on (−90,90)(-90, 90) from the solved world-frame axle vector joining wheel centre wc to outboard point wco, giving a physical angle by which to compare qδ∗q^*_\delta with q∗q^*.

A redundant model is consistent when some pose satisfies every row; then least squares finds it, the residual falls to round-off, and the answer is the square model's. It is a contradiction when no pose does; then least squares finds the pose of smallest misfit, and the residual stops on a floor above round-off. The prediction below tests the first way you might try to make one.

Predict first. Before the contradiction, a control. In geometry.yaml move ucar 2 mm forward and solve again at θ = 0.1. The least-squares residual floor:

Choose a prediction

Check answer (without scripting)

Answer: stays at round-off. Every joint row uses one site origin for both bodies, so the design pose satisfies every row for any numbers. You have built a different car, not a contradictory one.

Reveal result (lock in your prediction above first)

At the design pose with the drive at zero, the largest row with ucar moved is 6.1e-18. At θ = 0.1 the least-squares cost is 6.4e-32, and camber is -1.1297° against -1.1287° before: a different, consistent mechanism. The reason is in the row (problem-mapping §3): a joint at site origin oo between bodies AA and BB is

d=CTRAT((pB+RB o)−(pA+RA o)),d = C^{\mathsf T} R_A^{\mathsf T} \big( (p_B + R_B\, o) - (p_A + R_A\, o) \big),

one oo for both bodies. At the design pose (p=0p = 0, R=IR = I), d=0d = 0 whatever oo is.

A real contradiction needs the frame and the arm to disagree: the frame's pivot at o+δo + \delta, the arm's still at oo. With the frame as AA (pA=0p_A = 0, RA=IR_A = I) and this site's C=IC = I, the three uca-rear rows become d−δd - \delta. The Jacobian is unchanged; the residual is shifted by ee, with e=−δe = -\delta in those three rows and zero elsewhere. Below, that is exactly what is solved.

Move the frame's rear pivot. Negative fore-aft is aft, positive lateral is outboard. Each pose is the least-squares solution at θ = 0.1 rad, from SciPy's trf with otkd's exact Jacobian, seeded with the consistent pose.

Figure 1
Reveal result (lock in your prediction above first)
-2-1012-0.08390.3080.6991.091.48fore-aft (y)lateral (x)vertical (z)δ (mm)floor ‖r‖ (×10⁻³)
lca-ground.tx5.54e-14lca-ground.ty2.12e-14lca-ground.tz2.17e-14lca-ground.rx8.05e-15lca-ground.ry-3.17e-14uca-front.tx-2.33e-11uca-front.ty-0.489uca-front.tz-0.0243uca-rear.tx2.34e-11uca-rear.ty0.489uca-rear.tz0.0243lca-up.tx9.13e-14lca-up.ty-1.22e-12lca-up.tz6.83e-15uca-up.tx-5.15e-13uca-up.ty2.19e-11uca-up.tz1.91e-14tie-rod.length-2.22e-13lca-ground.rz0lca.unit0uca.unit0.098up.unit-1.11e-13residual (mm, or 10⁻³ for unitless rows)
δ floor ∥r∥\|r\| predicted ∣uTe∣\lvert u^{\mathsf T} e \rvert largest row uca.unit largest point shift camber shift
-1.00 mm, fore-aft (y) 6.99e-04 6.99e-04 4.89e-04 +9.8e-05 0.479 mm +0.0053°

Why the floor is ∣uTe∣|u^{\mathsf T} e|. Near the consistent pose q∗q^*, r(q∗+Δ)+e≈JΔ+er(q^* + \Delta) + e \approx J\Delta + e. Minimising over Δ\Delta is a linear least squares problem; its residual is ee minus its projection onto the range of JJ, that is the projection of ee onto the left null space. With one redundancy that space is the line through uu, so

r∗≈u (uTe),∥r∗∥≈∣uTe∣.r^* \approx u\,(u^{\mathsf T} e), \qquad \|r^*\| \approx |u^{\mathsf T} e| .

The residual's pattern is always uu's: front and rear fore-aft rows with opposite signs, a small share in the vertical rows and in uca.unit. Its size is the component of the error along uu. For the rear pivot that is δ\delta times uu's rear weights dotted with the direction of the error: about 0.70 per unit fore-aft, 0.035 vertically, and zero laterally. The lateral curve is not zero but quadratic: across the axis the arm swings to meet the pivot, the distance between the pivots changes only by about δ2/(2L)\delta^2 / (2L), and the pose moves instead. A 2 mm lateral error leaves a floor of 7.0e-06 and moves a point by 3.05 mm.

otkd's verdict. Run through otkd's own least_squares, the 1 mm aft case raises:

least squares did not converge: Both ftol and xtol termination conditions are satisfied.

Read the message with care. The quoted SciPy reason is a convergence message: its own tests on the step and on the fall in SS were met, at a minimum. What failed is otkd's extra demand that rr vanish too. A Gauss–Newton run on the same case shows both quantities: ∥r∥\|r\| goes 1.0e-01, 8.4e-03, 7.0e-04, 7.0e-04, 7.0e-04 and stops, while ∥JTr∥\|J^{\mathsf T} r\| goes 2.0e-01, 1.9e-02, 3.7e-05, 8.3e-09, 4.3e-14, 1.9e-15. The minimum was found; the rows disagree.

When reading the residual floor breaks
  • Assumes: the floor is measured against round-off for the size of the rows
  • When it fails: an error across the dependent direction raises the floor only quadratically, so a millimetre of misplacement can hide below a tolerance of 10−510^{-5} while the pose moves
  • Check: compare the floor with ∣uTe∣|u^{\mathsf T} e| for the errors you can imagine, and look at the pose, not just the residual

4. Weights and units

Setting: the problem, its sets and its symbols

Problem. Given the contradicted residual rδr_\delta with δ\delta = 1 mm aft, and a diagonal weight WW, find qW∗∈arg⁡min⁡q12∥Wrδ(q)∥2q^*_W \in \arg\min_q \tfrac12 \lVert W r_\delta(q) \rVert^2, and how qW∗q^*_W, its camber and its per-row residual depend on WW; repeat with δ=0\delta = 0.

Symbol In Meaning
qq Rn, n=21\mathbb{R}^{n},\ n = 21 the unknowns
rδr_\delta Rn→Rm, m=22\mathbb{R}^{n} \to \mathbb{R}^{m},\ m = 22 the residual of §3, Φ(q)+e\Phi(q) + e, with the 1 mm aft error
WW diag⁡(w1,…,wm), wi>0\operatorname{diag}(w_1, \dots, w_m),\ w_i > 0 the weights; wiw_i carries the inverse of row ii's unit, so every wiriw_i r_i is in one currency
ww {10−2,10−1.5,…,102}\{10^{-2}, 10^{-1.5}, \dots, 10^{2}\} the slider's weight on the three uca-rear rows
MM ⊂{1,…,m}\subset \{1, \dots, m\} the rows in metres (joint translations, the tie rod)
units\text{units} {metres,millimetres}\{\text{metres}, \text{millimetres}\} millimetres multiplies wiw_i by 1000 for i∈Mi \in M
qW∗, q∗q^*_W,\ q^* Rn\mathbb{R}^{n} the weighted pose, and the consistent pose of §1
γ\gamma (−90,90)(-90, 90) camber (deg)
How these symbols connect

Premultiplying the 22-row residual rδ(q)r_\delta(q) by a positive diagonal matrix WW forms the weighted objective 12∥Wrδ(q)∥2\tfrac12 \lVert W r_\delta(q) \rVert^2, whose minimiser is qW∗∈R21q^*_W \in \mathbb{R}^{21}. The two controls assemble WW together: units\text{units} scales every metre-valued row in MM by 10001000 when switched to millimetres, while the slider multiplies the three uca-rear rows by ww. Solving for qW∗q^*_W at both δ=1\delta = 1 mm aft and δ=0\delta = 0, and comparing camber γ\gamma and unweighted residuals against q∗q^*, measures how row scaling influences the pose.

Symbol-by-symbol notes
$W$ and its units

Here W=diag⁡(w1,…,wm)W = \operatorname{diag}(w_1, \dots, w_m) with every wi>0w_i > 0, so each row contributes wi2ri2w_i^2 r_i^2 to ∥Wrδ∥2\lVert W r_\delta \rVert^2. Assigning wiw_i the inverse of row ii's unit puts every product wiriw_i r_i into one dimensionless currency before squaring.

$w$ vs $W$

Lowercase w∈{10−2,10−1.5,…,102}w \in \{10^{-2}, 10^{-1.5}, \dots, 10^2\} is the slider factor applied only to the three uca-rear rows (tx, ty, tz), whereas uppercase WW is the full 22×2222 \times 22 diagonal matrix combining ww with any unit rescaling on MM.

$M$ and $\text{units}$

The subset M⊂{1,…,22}M \subset \{1, \dots, 22\} contains only the rows in metres (joint translations and the tie-rod length), excluding the driver row (rad) and dimensionless rotation and quaternion-norm rows. Selecting millimetres multiplies wiw_i by 10001000 for i∈Mi \in M while leaving all other rows unchanged.

$q^*_W$ vs $q^*$

Both live in R21\mathbb{R}^{21}, and camber γ\gamma and point shifts compare qW∗q^*_W against the unweighted consistent pose q∗q^* from §1; after solving with WW, individual row residuals are still displayed unweighted in their original units.

One residual holds metres (joint rows), radians (the driver row) and pure numbers (the rotation and quaternion-norm rows; problem-mapping §3.6 lists each row's unit). An unweighted 12∥r∥2\tfrac12\|r\|^2 prices a metre, a radian and a unit of norm the same: an exchange rate no one chose. Weighting makes the choice explicit: minimise 12∥Wr∥2\tfrac12\|W r\|^2 with WW diagonal. Writing rows in millimetres is W=1000W = 1000 on those rows. The prediction below asks what that choice does.

The control is the weight on the rear leg's rows, with the 1 mm aft error of §3.

Predict first. Keep the 1 mm aft error. Rewrite every joint row in millimetres instead of metres (the driver row stays in radians, the norm rows stay pure numbers). Where does the misfit go?

Choose a prediction

Check answer (without scripting)

Answer: into the upper arm's quaternion norm: the arm changes size. Millimetre rows cost a thousand times more per metre, while uca.unit costs the same; R(q)R(q) scales lengths by ∣q∣2|q|^2, so resizing the arm by the error over its length is the cheapest compromise. The legs are then met almost exactly.

Reveal result (lock in your prediction above first)
uca-front.ty-0.489uca-front.tz-0.0243uca-rear.ty0.489uca-rear.tz0.0243uca.unit0.098residual (×10⁻³)
joint rows in rear-leg weight camber camber shift from consistent largest point shift uca.unit
metres 1 -1.1234° +0.0053° 0.479 mm +9.80e-05

Residuals are shown unweighted, in metres (×10⁻³, so millimetres) or as pure numbers. In metres with equal weights the camber moves +0.0053°; in millimetres it moves +0.2238°, about 42 times as far, because uca.unit takes +4.99e-03: the arm is scaled by ∣q∣2|q|^2, about 0.50 %, which is 1 mm over the 200 mm between the pivots. A heavy rear weight puts the misfit in the front leg, a light one in the rear leg: the pose follows the weights.

The consistent model does not care. With no error, across every weight and both units on this slider, the solved pose differs from the unweighted one by at most 1.7e-15. Weights change a consistent model's conditioning and iteration path, never its answer.

When a weighted residual breaks
  • Assumes: the weights say how much a unit of misfit in each row costs, in one common currency
  • When it fails: rows in different units are weighted by accident; a weak row (here the quaternion norm) absorbs the contradiction and the model stops being the mechanism
  • Check: solve with two different, defensible weightings: a consistent model gives the same pose, a contradicted one does not

5. Right, or merely small

Setting: the problem, its sets and its symbols

Problem. Given the contradicted residual rδr_\delta and the dependent set KK, (i) compare rδ(qδ∗)r_\delta(q^*_\delta) for the error on the rear pivot with the residual for the same error on the front pivot; (ii) for each k∈Kk \in K find q(k)q^{(k)} solving the square system rδ,i(q)=0r_{\delta, i}(q) = 0, i∈I∖{k}i \in I \setminus \{k\}, and compare the q(k)q^{(k)} with each other and with qδ∗q^*_\delta.

Symbol In Meaning
II {1,…,m}, m=22\{1, \dots, m\},\ m = 22 the row index set
KK {i∈I:ui≠0}\{i \in I : u_i \neq 0\} the dependent set: the rows the left null vector uu links (§1)
rδr_\delta Rn→Rm\mathbb{R}^{n} \to \mathbb{R}^{m} the residual with the 1 mm aft error (§3), mixed units
ef, ere_{\mathrm{f}},\ e_{\mathrm{r}} Rm\mathbb{R}^{m} the shift for the error on the front pivot, and on the rear (m)
qδ∗q^*_\delta Rn, n=21\mathbb{R}^{n},\ n = 21 the unweighted least-squares pose
q(k)q^{(k)} Rn\mathbb{R}^{n} the solution with row kk dropped
J−kJ_{-k} Rn×n\mathbb{R}^{n \times n} the Jacobian without row kk, and κ(J−k)\kappa(J_{-k}) its condition number
γ\gamma (−90,90)(-90, 90) camber (deg)
kik_i (0,∞)(0, \infty) a joint row's stiffness (N/m), for the closing argument
How these symbols connect

This section runs two tests on the contradicted model using the dependent row set K⊂IK \subset I named by uu in §1. First, applying the 1 mm aft pivot offset as efe_{\mathrm{f}} (front pivot) versus ere_{\mathrm{r}} (rear pivot) lets us compare the resulting least-squares residuals and poses qδ∗q^*_\delta. Second, deleting each row k∈Kk \in K in turn leaves a 21×2121 \times 21 square system with Jacobian J−kJ_{-k} and exact solution q(k)q^{(k)}, whose camber γ\gamma and conditioning κ(J−k)\kappa(J_{-k}) we compare across KK and against qδ∗q^*_\delta, before using physical joint stiffnesses kik_i to judge when a weighted compromise has physical meaning.

Symbol-by-symbol notes
$K \subset I$

The dependent set K={i∈I:ui≠0}K = \{i \in I : u_i \neq 0\} collects only the rows carrying non-zero weight in the left null vector uu of §1 (numerically above 10−1010^{-10}). Rows in I∖KI \setminus K do not participate in the redundancy.

$e\lt em>{\mathrm{f}}$ vs $e\lt /em>{\mathrm{r}}$

Both vectors lie in R22\mathbb{R}^{22} (entries in metres) and encode the same 1 mm aft frame-pivot offset: efe_{\mathrm{f}} places −δ-\delta on uca-front.ty, whereas ere_{\mathrm{r}} places it on uca-rear.ty (the shift used in §3–4).

$q^{(k)}$ and $J_{-k}$

Omitting one row k∈Kk \in K removes one equation from the 22-row model, leaving the square 21×2121 \times 21 Jacobian J−kJ_{-k} and the pose q(k)q^{(k)} where the remaining 21 rows vanish exactly. The superscript (k)(k) labels the omitted row, not an iteration counter.

$q^*_\delta$ vs $q^{(k)}$

While qδ∗q^*_\delta minimises 12∥rδ(q)∥2\tfrac12 \lVert r_\delta(q) \rVert^2 across all 22 rows in II, each q(k)q^{(k)} satisfies rδ,i(q(k))=0r_{\delta, i}(q^{(k)}) = 0 for all i≠ki \neq k and leaves any residual solely in the omitted row kk.

Stiffness $k_i$ vs omitted row $k$

Do not confuse the omitted row index k∈Kk \in K with the physical joint stiffness ki>0k_i > 0 (in N/m), used in the closing discussion to connect weighted least squares with elastic strain energy.

Two tests decide what a least-squares pose is worth. The first is the prediction below: can the residual say which row is wrong? The second drops rows.

Predict first. Put the same 1 mm aft error on the front leg's frame pivot instead of the rear. Does the least-squares residual point at the front leg?

Choose a prediction

Check answer (without scripting)

Answer: no: the same pattern, with the opposite sign. Both errors project onto the same line, the left null space. The residual names the dependent set, never its faulty member; the two poses differ, the residuals do not.

Reveal result (lock in your prediction above first)

Residual with the error on the front pivot plus residual with it on the rear: at most 2.4e-07 in any row, against a floor of 7.0e-04. The patterns are equal and opposite to second order. The poses are not: camber -1.1321° with the front pivot out, -1.1234° with the rear, -1.1287° as drawn. The residual is the projection of the error onto the left null space, a single line, so it cannot carry which member of the dependent set is wrong. This is the deeper page's warning, measured: least squares does not tell you which equation is wrong.

Drop a dependent row. M08 §2 dropped uca-front.ty and showed that Newton on the square system matches least squares. That is a test of consistency only if it is repeated: in a consistent model every member of the dependent set says the same thing, so every drop gives the same pose. Keep the 1 mm aft error and drop each of the five in turn.

drop uca-front.ty-1.13drop uca-front.tz-1.29drop uca-rear.ty-1.13drop uca-rear.tz-0.922drop uca.unit-0.905least squares, all rows-1.12camber at θ = 0.1 (deg)

Dropping uca-front.ty: the square system has condition number 47; its exact solution leaves 1.00e-03 in the dropped row, moves a point by 1.00 mm and gives camber -1.1268° (the dashed line is the pose as drawn, -1.1287°). With no error, all five drops agree with least squares to 1.7e-15 in every pose coordinate.

Each drop declares one member of the dependent set to be the wrong one and believes the rest. Dropping uca-rear.ty discards exactly the row that carries this error and recovers the drawn pose. The vertical rows have small weight in uu, so believing them over a fore-aft row moves points several millimetres for a 1 mm error, through a square system with condition number near 10⁴. Dropping uca.unit lets the arm change size freely, and lands on the millimetre-weighted pose of §4. Least squares sits between them, at a point set by the weights.

So a least-squares pose is right when the floor is at round-off: the model is consistent, every drop agrees, and the weights do not matter. With a floor above round-off it is merely small, unless the weights mean something physical. One choice does: if each row is a joint of stiffness kik_i, then 12∥Wr∥2\tfrac12\|W r\|^2 with W=diag⁡(ki)W = \operatorname{diag}(\sqrt{k_i}) is the strain energy, and its minimum is the pose the real corner takes when its bushes share the misfit. That needs the rigid rows, such as the quaternion norms, held as hard constraints, which is the KKT problem of M04 §6. Unit weights in mixed units are not that.

When dropping a dependent row breaks
  • Assumes: the model is consistent, so every member of the dependent set says the same thing
  • When it fails: with a contradiction each drop gives a different pose, and a row with a small weight in the left null vector gives an ill-conditioned square system that moves the pose far
  • Check: drop each member of the dependent set in turn; agreement to round-off is consistency

Practice

Practice A (steps partly filled). The left null vector's rear-leg weights are 0.699 on uca-rear.ty and 0.035 on uca-rear.tz (same sign), and zero on uca-rear.tx. The frame's rear pivot is 2 mm aft (δy=−2\delta_y = -2 mm) and 1 mm high (δz=+1\delta_z = +1 mm). The shift is e=−δe = -\delta in those rows, so uTe=0.699×2+0.035×(−1)=  ?u^{\mathsf T} e = 0.699 \times 2 + 0.035 \times (-1) = \;? Enter the floor ∣uTe∣|u^{\mathsf T} e| in millimetres.

Worked solution

∣0.699×2−0.035×1∣=1.363|0.699 \times 2 - 0.035 \times 1| = 1.363 mm. The two errors partly cancel, because aft and up are opposite senses along this arm's axis. The nonlinear least-squares solve for the same error leaves a floor of 1.366 mm.

Practice B (with a hint). Two rows disagree about one unknown: x=0x = 0 with weight w1=1w_1 = 1, and x=dx = d with weight w2=3w_2 = 3, where d=1d = 1 mm. Enter the weighted least-squares xx, in millimetres.

Worked solution

x∗=9×1/(1+9)=0.9x^* = 9 \times 1 / (1 + 9) = 0.9 mm. A weight of 3 buys nine times the say. With stiffnesses as w2w^2, this is two springs in series sharing a 1 mm misfit, and x∗x^* is where they balance.

Hint 1

Minimise 12(w12x2+w22(x−d)2)\tfrac12\big(w_1^2 x^2 + w_2^2 (x - d)^2\big): set the derivative to zero.

Hint 2

x∗=w22d/(w12+w22)x^* = w_2^2 d / (w_1^2 + w_2^2): the weights enter squared.

Practice C (on your own). At the two-leg answer, κ(J)≈47\kappa(J) \approx 47 (§2). Enter log⁡10\log_{10} of the condition number of the normal-equations matrix JTJJ^{\mathsf T} J.

Worked solution

κ(JTJ)=κ(J)2\kappa(J^{\mathsf T}J) = \kappa(J)^2, so 2log⁡1046.8=3.342 \log_{10} 46.8 = 3.34; §2's table measures 2187. About three and a third digits lost per step, which the next Gauss–Newton step repairs on a consistent model.

Mixed practice: which method, and why?

Name the class of problem before you pick.

1. A rig measures camber at 200 wheel travels; you fit a three-coefficient curve. Which method, and why?

Question 1
How sure?

2. otkd's one-piece double-wishbone corner (the book's §1.2 mechanism): 21 rows, 21 unknowns, full rank. Which method, and why?

Question 2
How sure?

3. A redundant corner's least-squares floor is 1e-15. You want to know which rows are spare. Which method, and why?

Question 3
How sure?

4. A corner with rubber bushes at the inner pivots, and a bracket known to be 1 mm out. You want the pose the car actually takes. Which method, and why?

Question 4
How sure?

5. Every hardpoint is placed to within 0.5 mm, independently. How far does camber at bump spread? Which method, and why?

Question 5
How sure?

Show answers and explanations

1. Linear least squares by QR, and read the floor as noise. The curve is linear in its coefficients, so one QR solve (M03 §5). The floor is expected here: it is measurement noise, not a modelling fault.

2. Newton, seeded from the previous frame. Square and full rank: Newton converges quadratically, and the previous frame keeps the same assembly (M02).

3. The left null vectors of the SVD, then drop one dependent row and re-solve. The left null space names the dependent set (M03 §6); dropping one member and re-solving must give the same pose, which confirms consistency.

4. Minimise strain energy, the rigid rows held as constraints: a KKT solve. Weights of k\sqrt{k} on the compliant rows make 12∥Wr∥2\tfrac12\|Wr\|^2 the energy; the norms and rigid joints stay hard, which is the KKT system of M04 §6.

5. Sample the hardpoints, solve each corner, report the spread with an error bar. A spread over uncertain inputs is an average; Monte Carlo's error falls like 1/N1/\sqrt N (M07). Each sample is a consistent model if the error is in shared points, as §3 showed.

Check yourself (closed book)

1. otkd's least_squares hands SciPy the residual r(q)r(q) of the two-leg corner. What does it minimise, and when does it stop?

Question 1
How sure?

2. Gauss–Newton drops the term ∑iri∇2ri\sum_i r_i \nabla^2 r_i from the Hessian of 12∥r∥2\tfrac12\|r\|^2. On which problems does that cost it its fast convergence?

Question 2
How sure?

3. You move ucar 2 mm in the two-leg corner's geometry.yaml. What happens to the least-squares residual floor?

Question 3
How sure?

4. The frame's rear pivot is 1 mm out, the arm's is not. Which direction of error raises the floor in proportion to the error?

Question 4
How sure?

5. A consistent redundant model is solved with different row weights. What changes?

Question 5
How sure?

6. The two-leg corner's residual mixes metres (joint rows), radians (the driver) and pure numbers (quaternion norms). Rewrite the joint rows in millimetres. With a 1 mm contradiction, where does the misfit go?

Question 6
How sure?

7. With one redundancy, a contradicted least-squares residual has a pattern over the rows. Does it say which leg's pivot is wrong?

Question 7
How sure?

8. When is a contradicted least-squares pose the physically right one?

Question 8
How sure?

Show answers and explanations

1. Half the squared length of r; it stops when the gradient J^T r vanishes. S(q)=12∥r∥2S(q) = \tfrac12\|r\|^2 has gradient JTrJ^{\mathsf T} r. A minimum is where no move reduces SS, which is not the same as r=0r = 0.

2. Problems whose residual at the answer is large. The dropped term is weighted by the residual. At a zero residual it vanishes and Gauss–Newton is as fast as Newton; with a large floor it converges only linearly.

3. It stays at round-off: both bodies' copies of the point move together. Every joint row uses one site origin for both bodies, so the design pose satisfies every row exactly, whatever the numbers. The model is a different mechanism, not an inconsistent one.

4. Along the line between the two pivots, the arm's axis. The left null vector's weights are the axis direction: the floor is ∣uTe∣|u^{\mathsf T} e|, about 0.70 per unit error along the axis and nearly zero across it.

5. Nothing that matters: the same pose, perhaps a different iteration path. The zero-residual point is the minimum for every positive weighting. Weights change the conditioning and the path, not where the iteration ends.

6. Into the upper arm's quaternion norm: the arm changes size instead of the legs. Millimetre rows are a thousand times dearer, and R(q)R(q) scales with ∣q∣2|q|^2, so the cheapest compromise denormalises the quaternion: about a 0.5 % change of size, and a camber shift forty times larger than in metres.

7. No: it names the dependent set, not the faulty member. The residual is the projection of the error onto the left null space, which is one fixed direction. Any row in the dependent set could carry the error.

8. When each weight is the square root of that row's stiffness and the rigid rows are hard. Then 12∥Wr∥2\tfrac12\|W r\|^2 is the elastic energy, and its minimum is the equilibrium. Unit weights, or a soft quaternion norm, are not physics.

Keep these:

  1. Redundancy is rows minus rank; the left null vector names the rows that restate each other, here both legs' fore-aft and vertical rows and the arm's quaternion norm.
  2. Least squares minimises 12∥r∥2\tfrac12\|r\|^2 and stops when JTr=0J^{\mathsf T} r = 0; Gauss–Newton solves a linear least-squares problem per step (by QR), and otkd's trust region limits that step until the model is trusted.
  3. Floor at round-off: consistent, and the answer is the square model's. Floor above it: a contradiction, of size about ∣uTe∣|u^{\mathsf T} e|, and only errors along the dependent direction raise it in proportion.
  4. A contradicted answer belongs to the weights; units are weights. A consistent answer does not depend on them.
  5. The residual names the dependent set, never the faulty row. A compromise is right only when the weights are physical (square roots of stiffnesses) and the rigid rows are hard.

Your connection

Think of a fit or a model you rely on that has more equations than unknowns. Is its floor round-off, noise or a contradiction, and what weights is its answer using?

Answers

Practice A. ∣0.699×2−0.035∣=1.363|0.699 \times 2 - 0.035| = 1.363 mm.

Practice B. x∗=0.9x^* = 0.9 mm.

Practice C. 3.343.34, since κ(JTJ)=κ(J)2\kappa(J^{\mathsf T}J) = \kappa(J)^2.

Mixed practice. QR least squares; Newton; the left null space then a drop; an energy minimisation with hard rows (KKT); Monte Carlo.

Where the maths is derived

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

§2 What least squares minimises, and how otkd does it

§3 A consistent redundancy against a contradiction

§4 Weights and units


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

Back to the book: 1.3 Two legs, one contradiction · 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.