Two routes to a sensitivity
Assumes A length is a range.
The previous essay found the tolerance band by building sixteen linkages at every crank angle. That works and it is expensive: 1,152 solves for one curve, and the cost multiplies by sixteen again for a six-bar.
There is a cheaper route, and the interesting thing about it is not that it is cheaper.
The obvious route
Change the length, solve again, subtract, divide. A central difference: build the mechanism at b + h, build it at b − h, take the two output angles and divide their difference by 2h.
This route knows nothing about derivatives. It goes through the whole machine — the initial guess, the branch selection, the line search, the stall rule — so what it measures is the derivative of what the site actually draws, not of the equations the drawing is supposed to come from. If those two things had drifted apart, this is the one that would tell the truth.
Its weakness is arithmetic. Two answers each converged to 10⁻¹³ differ by 10⁻¹³ of noise, and dividing by 2h multiplies that noise by 1/2h. At h = 10⁻⁶ that is 10⁻⁷ of noise on a quantity of order 0.3 — six decades of headroom, which is comfortable. At h = 10⁻¹⁰ it would be 10⁻³ of noise, and the answer would be mostly garbage. Making the step smaller makes a finite difference worse past a point, which is the first thing anybody learns about them and the thing most easily forgotten when a result looks noisy.
The other route
The constraint equations hold not just at one set of lengths but at every nearby set. Write them as f(x, ℓ) = 0, where x is the joint coordinates and ℓ is a length. Differentiate the whole thing with respect to ℓ:
The first factor is J, the constraint Jacobian — the same matrix the solver has been taking Newton steps with since the foundation phase. So
and the output angle’s sensitivity follows by the chain rule through the arctangent that defines it. One linear solve per length, and no solve of the mechanism at all beyond the one that put it where it is.
This is the implicit function theorem doing exactly what it is for. The interesting part is what goes into ∂f/∂ℓ, because the four lengths are four genuinely different objects to the solver and only three of them are lengths.
Three of the four are lengths and one is a position
A bar constraint’s residual is |b − a| − L, so its derivative with respect to L is −1 in that row and zero in every other. That covers the coupler and the rocker.
The crank is driven rather than constrained by a bar: its residual rows say the crank pin is at a specified angle and radius from the fixed pivot, so the derivative with respect to the crank length is −cos θ and −sin θ in the two rows.
And the ground length g appears in no residual at all. It is not a link in the equations; it is the position of the fixed pivot O₄. It enters through the constant part of the rocker’s row, and it enters a second time through the definition of the output angle itself, which is measured at O₄ — move the pivot and the reading changes even with the rocker pin held still.
Both parts are needed. Dropping the second is an easy mistake and it makes the ground length look like the least critical of the four; it is in fact the second most critical. This is the sort of thing that a second route catches immediately and a single route never does, because a wrong derivative that is smooth and plausible looks exactly like a right one.
What the four numbers look like
It is worth seeing the sensitivities themselves before arguing about how they were obtained, because they are not featureless.
Each of the four is a curve through the turn, and each changes sign somewhere. A sign change means there is a crank position at which making that link longer stops pushing the output one way and starts pushing it the other — and at that position the link’s contribution to the tolerance band is momentarily zero. A mechanism has, for each of its lengths, positions at which that length does not matter at all.
That has a practical consequence which is not obvious. If a linkage has to hit one particular output angle at one particular input angle — a mechanism that closes a valve at a definite point in a cycle, say — then the right question is not how tight the tolerances should be but whether there is a position near the wanted one at which the length that cannot be held accurately happens not to matter. Sometimes there is, and moving the design point by a few degrees is free where tightening a tolerance is not.
The four curves also have very different magnitudes, and that is the next essay. What matters here is that both routes produce all four, and that a route producing only the total would not support any of this.
Both routes go through the same solved configuration
One shared assumption is worth naming, because it limits what the agreement proves.
Neither route is independent of where the mechanism is. Both start from a configuration the solver found, and if the solver had landed on a different assembly branch, both routes would report the sensitivities of that branch instead. They would still agree with each other, and they would both be answering a question about a different mechanism from the one the caption names.
So the agreement tests the derivative and not the branch. What tests the branch is the sweep: the crank is driven continuously from a known configuration and each solve is seeded by the last, so the mechanism cannot hop branches without the residual saying so. The two checks are complementary and neither substitutes for the other, which is worth saying because “computed two ways” is exactly the sort of claim that grows in the retelling into “checked everything”.
What the agreement is worth
Across a whole turn, 144 comparisons — four lengths at thirty-six positions — the worst relative disagreement between the two routes is 2.1 × 10⁻⁸.
That number is doing more work than it looks, and to see why it is worth recalling the site’s worst hour.
Four terms in this Jacobian carried the wrong sign from the foundation phase until 2026-08-12. The error was exactly v ↦ −v in the rows for a coupler point, so it vanished for a point on the coupler line and grew with the offset. It never drew a wrong picture: a wrong derivative is still usually a descent direction, so the line search kept finding an improving step and the solve still converged. What it did instead was refuse positions — 267 of 360 crank angles at an offset of 1.2 — and a sweep with missing frames is still a sweep.
The check that should have caught it could not. assertVelocityAgreesWithFiniteDifference obtains the analytic velocity by solving with the same Jacobian, so both sides of that comparison went through the wrong matrix and agreed beautifully. A check that compares a program against itself is not a check, however different the two calculations look on the page.
The sensitivity comparison does not have that defect. One side never touches the Jacobian — it rebuilds the mechanism and solves — and the other side is nothing but the Jacobian. A sign error in any row would put the two routes several per cent apart, not two parts in a hundred million. This is the first independent test of that matrix the site has ever had, and it arrived three phases after it was needed.
attach rows — the ones for a point rigidly fixed to the coupler — are where the four wrong signs lived. Every other row type was correct throughout, which is why the defect was invisible: most figures on this site do not carry a coupler point, and the ones that do are drawn at the position the solver reached rather than at the ones it silently declined to reach.The residual strip, and why it is not flat
The gap between the two routes is not constant around the turn, and its shape is informative.
It is smallest where the sensitivity itself is small, which is arithmetic: a relative comparison of two small numbers. It rises where the sensitivity rises. And there is a floor underneath it at around the finite-difference noise level, which is where the comparison stops being a test of the Jacobian and starts being a test of the step size.
None of that is a defect. It is the signature of a comparison that is working: two independent computations of the same quantity, agreeing to the precision the weaker of them has. If the strip were exactly flat at machine epsilon, the right conclusion would be that the two routes are not independent after all.
attach rows carried the wrong signs, which is why the defect was invisible in every figure without a coupler point — and why a check that exercised only bar and crank rows would have passed for four phases too.The general shape of the trap
It is worth stating the failure abstractly, because it is not about Jacobians and it recurs everywhere on this site.
A verification compares two computations of a quantity. It has content exactly to the extent that the two computations can disagree. If they share a step, they cannot disagree about anything that step gets wrong, and the check silently becomes a check of everything except the shared step — while continuing to look, and to be described, as a check of the whole.
This site has now found three instances. The conjugate-action test parameterised both tooth flanks by the same roll angle and announced that the velocity ratio was constant, which is a restatement of the definition of an involute rather than a test of it. Bennett’s closure check seeded the solver with the exact closed form, so Newton moved the angles by exactly zero and the assertion passed with the solver never having run. And the velocity check shared a Jacobian.
All three passed for as long as they existed. All three were rewritten to split the shared step out, and all three then measured something — the conjugate-action test immediately reported 94% error on a correct flank, because its first honest version used a dot product where a cross product was needed.
The pattern is worth carrying: when a check has never failed, the first question is not whether the code is right but whether the check could fail. That is why this site’s gate ends by feeding its own machinery input it must refuse.
When the cheap route is not merely cheaper
Having two routes that agree is worth having for its own sake. But the derivative route also answers a question the corner enumeration cannot.
The corner enumeration returns a band. It does not say which length is responsible for it, because the sixteen corners each vary all four at once. The derivative route hands over four separate numbers — one per length — and their sum is the band. That decomposition is the entire content of tolerance allocation, and it is why a designer computes derivatives rather than enumerating corners even when corners are affordable.
It also scales. Sixteen corners is 2⁴; a six-bar has seven lengths and 128 corners, and a spatial mechanism with twenty parameters has a million. The derivative route costs one linear solve per parameter, so twenty parameters is twenty solves rather than a million.
Where the derivative route stops being right
The implicit function theorem needs J to be invertible. Everywhere the four-bar is an ordinary mechanism it is, and the two routes agree to eight decimals.
At a change point they do not, and the failure is total rather than gradual — the derivative goes to infinity while the measured band stays finite and small. That is a whole essay, and the important part of it is that the ratio between the two routes is a diagnostic: a tolerance analysis that has quietly wandered near a singularity announces itself by the two routes parting company, and a tolerance analysis with only one route has no way to notice.
Two routes are not twice the confidence of one. They are a different kind of confidence, and this site has now paid for the difference twice.
Why not just use automatic differentiation
A reasonable objection: both routes here are handwritten, and a third exists that is neither. Differentiate the solver itself, symbolically or by dual numbers, and get exact derivatives with no analysis at all.
It would work, and it would be a third route rather than a replacement for either. What it would not be is independent of the solver’s own correctness in the way the finite-difference route is. Automatic differentiation of a program computes the exact derivative of that program, including the exact derivative of any mistake in it. Handed the Jacobian with four wrong signs, it would have reported the exact sensitivity of the mechanism that Jacobian describes — which is not the mechanism the caption names.
That is the general shape of the thing: a route is only independent to the extent that it does not share a step. Finite differences on the whole solve share the solver’s output and nothing else, which is exactly why they are slow, noisy and worth having.
The step size, chosen rather than assumed
One number in this essay was picked and it is worth saying how.
The finite-difference step is 10⁻⁶ on lengths of order 1 to 4. It sits between two failures. Too large, and the difference quotient measures the average slope over an interval on which the function has curved — the error grows like the step. Too small, and it measures the noise in two converged solves divided by a tiny number — the error grows like one over the step. The sum of those has a minimum, and for a solve converged to 10⁻¹³ on a quantity of order 1 the minimum sits near the square root of the convergence tolerance, which is about 10⁻⁶ or 10⁻⁷.
That square-root rule is worth carrying: the best step for a central difference is roughly the square root of the precision of the function being differenced, and the achievable accuracy is roughly that same square root. Six decades of headroom is what a 10⁻¹³ solve buys, and it is why the solver aiming far below the tolerance it is judged against — which looked like an eccentricity when it was written — turns out to have bought something.
Had the solver stopped at its stated tolerance of 10⁻⁹, the best available finite-difference accuracy would be around 10⁻⁴·⁵, and the agreement in this essay would be four decades worse. The two routes would still agree; they would agree to a part in thirty thousand instead of a part in fifty million, and a sign error in a small term could have hidden in the difference.
What a sensitivity is not
A last caution, because the word gets stretched.
A sensitivity here is a derivative of a position with respect to a dimension. It says where the rocker will be if the coupler is long. It says nothing at all about force, and it is easy to slide from one to the other because the transmission angle sits so close by and is about force.
The slide is tempting because both quantities peak in the same places. A configuration where the coupler pushes badly on the rocker is a configuration where a length error moves the rocker a lot, and the shared cause is that the constraint equations are badly conditioned there. But “badly conditioned” has two consequences and they are not the same consequence: force transmits poorly and error transmits well. A mechanism can be fixed for one and not the other — increasing the rocker length can improve the worst transmission angle while making the output more sensitive to the rocker’s own tolerance, because the two quantities depend on the geometry differently.
So the two figures in this essay belong side by side and not on top of one another. What they share is a cause; what they measure is a pair of different things a designer has to trade against each other, and the trade is only visible once both have been computed rather than one inferred from the other.
What this makes readable
Essays that name this one as a prerequisite.
- The four lengths do not matter equally As built
- Where an error at the shoulder ends up One path to the tool
About the same objects
Not linked from either essay — found by the objects both name.
- A clearance is a link constraint · four-bar · jacobian · tolerance
- Counting and measuring mobility constraint · jacobian · rank · tolerance
- Four bars and four pins constraint · four-bar · newton–raphson · tolerance
- The seventh contact constraint · rank · sensitivity · tolerance
- Two things called jamming constraint · constraint jacobian · jacobian · rank
- What each joint takes away constraint · constraint jacobian · jacobian · rank
What links here
The 8 of 23 essays linking to this one that name the most of the same objects.
- A length is a range As built
- Seven lengths and a hundred corners As built
- The four lengths do not matter equally As built
- Tolerancing the holes As built
- Worst case and the square root As built
- Which pin to buy As built
- Six points and no more Machines you have met
- Taking up the play As built
The objects this essay names
Each one links to every other essay that touches it.
ConstraintConstraint jacobianDerivativeFinite differenceFour-barImplicit-functionJacobianNewton–RaphsonRankSensitivityTolerance