A Byte of PhysicsLogo

Symbolic unit checking

You can inspect an equation before inserting a single number. Reduce each symbol to dimensions, then compare both sides as if a compiler were checking types.

Think like a programmer

A symbolic unit checker parses an expression tree and propagates dimensions through each node. Its most useful output is not “false”; it is the first operation where incompatible dimensions meet.

Model checklist

Inputs
An equation and a dimension for each symbol.
State
Dimensions carried through the expression tree.
Rule
Multiply and divide dimensions; require equal dimensions for addition.
Output
The reduced dimension or a mismatch location.
Check
Speed × time reduces to length.
type Dimension = Record<"length" | "time" | "mass", number>;
// { length: 1, time: -1, mass: 0 } represents m/s.

Dimensions are part of the contract

5 m/s × 4 s = 20 m

Try this experiment

Prediction: The product of speed and time has length as its only remaining dimension.

Use the lab as a concrete check. Then imagine changing the plus sign in distance = speed + time: which expression node should the checker flag first?

Where this model breaks

Symbolic checking cannot validate numerical conversion factors or semantics. Two quantities can share dimensions and still represent different concepts, such as two positions in different coordinate frames.

Summary

Represent dimensions explicitly, reduce them with the same tree structure as the equation, and show the first mismatch clearly.

Glossary

Self-check

  1. Which dimensions must match for addition?
  2. What does m/s × s reduce to?
  3. What error can symbolic checking not catch?

Sources

Model contract

Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.

\[\text{observable output} = f(\text{inputs},\,\text{state})\]
Inputs
Quantities you set or measure, with units and useful bounds.
State
Values the program must retain to reproduce the next result.
Rule
The relationship or update that turns inputs and state into a result.
Check
A known limit, unit check, invariant, or measured result that can expose a bad model.

Implement the idea as a model

For Symbolic Unit Checking, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Measurement, Units, and Uncertainty, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.

Guided experiment

Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.

Where this model breaks

This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.

Summary

Treat Symbolic Unit Checking as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.

Glossary

  • Input: a measured value or chosen parameter supplied to a model.
  • State: the smallest set of values needed to continue or reproduce a model.
  • Validation: comparing an output with a known result, limit, invariant, or measurement.

Self-check

  1. Which values are inputs, and which values must remain state?
  2. What observable result would tell you the model is behaving as expected?
  3. Which assumption would you test first before applying the model to a real system?

Model review: turn Symbolic Unit Checking into a test

Reduce both sides of a small equation to base dimensions and make the first mismatch visible before running a model.

  1. Name the inputs and units that the measurement, units, and uncertainty model needs.
  2. Separate the state you must keep from values you can calculate when needed.
  3. Write one rule that maps the current state and inputs to an observable result.
  4. Choose a limiting case, unit check, invariant, or known result before trusting an output.
  5. State one assumption you would change before using this simplified model for a real decision.

Share to: