Symbolic Physical Laws DiscoveryFoundations

Module 3Encoding physics and domain knowledge

Before any data arrive, we usually know a lot: units, what is conserved, which symmetries hold, the shape of a response, values at a boundary, limiting behaviour, part of the mechanism. This module turns that knowledge into code. With a draining tank as the running example, we sort eight kinds of knowledge, inject the same rule four ways (hard, soft, preferential, after the search), and use units to type-check every node and to shrink five variables to three dimensionless groups. The second video adds conservation (integrating beats differentiating; an unknown invariant found from trajectories), symmetry through invariant variables, shape constraints with a range, boundaries, limits and skeletons, diagnostics for wrong knowledge, and a ladder of knowledge whose every rung is measured.

By the end you should be able to classify prior knowledge, choose how strongly to encode it, find dimensionless groups, and measure what each piece of knowledge buys with weight paths and ablations.

Key ideas, one per video

  • Video 6A soft never-rises rule repaired the cubic's three-minute prediction (from −17 cm to about 6 cm) at no cost inside the data; units turned five variables into three groups, and forty runs collapsed onto one line.
  • Video 7On ten big tanks, data alone missed by 174% (eight negative drain times); units brought it to 1.8% and the scaling rung to 1.5% with Cd = 0.600. A wrong prior kept the error near 58% at every weight.

Book: Chapter 3 of Computational Methods for Symbolic Physical Laws Discovery by Teddy Lazebnik (coming soon). The videos and slides follow the chapter’s topics in our own words, figures and simulations; nothing is copied from the book.

The title slide of Module 3: Encoding physics and domain knowledge

34 slides, written to be read on your own, with worked examples, our own small simulations and check-yourself questions (answers at the end). PDF, 1.7 MB.

Watch

2 videos for this module, each about 8 to 15 minutes. Pick one from the list, and open the transcript to read along: each timestamp plays the video from there. The narration is generated with a voice clone of Teddy, used with his permission.

Video 6 · 8:01

Knowledge you can execute

A cubic fits a draining tank to within two millimetres, then predicts a level of minus 17 cm. We knew better; the search didn't.

A soft never-rises rule repaired the cubic's three-minute prediction (from −17 cm to about 6 cm) at no cost inside the data; units turned five variables into three groups, and forty runs collapsed onto one line.

TranscriptVideo 6
0:00

A tank, a cubic, and an impossible level. A tank drains through a small hole. We log its water level every two seconds, for one minute. Two formulas fit that minute equally well, to within two millimetres: a cubic polynomial, and Torricelli's law with two constants. Now ask them about the future. After three minutes, the cubic says the level is minus 17 centimetres. Torricelli says 6. The tank empties after about five minutes. We knew all along that water can't go below empty. The search didn't, because nobody told it in a form it could execute. Welcome to Module three: encoding physics and domain knowledge. In this video: the kinds of knowledge we have, four ways to inject the same knowledge, and units, the most executable knowledge of all, right up to dimensionless groups. Here's the principle for this module. Scientific discovery is data evidence, plus search, plus explicit knowledge, plus independent tests. It's not an equation you can solve. It's a reminder that knowledge can enter at many points, and that the same knowledge can enter in more than one way. A scientific constraint is a computable restriction, preference or test that comes from what we already know. If it doesn't change which formulas are generated, kept or trusted, it isn't doing any work.

1:19

Kinds of knowledge. Part one: what kinds of knowledge are there? Let's sort them, using our tank. Units: the level is a length, so the speed of the water leaving the hole must be a length per time. Conservation: the water that leaves through the hole is exactly the water missing from the tank. Symmetry: turn the tank around its axis, and nothing changes. Shape: with no inflow, the level never rises, and it never goes below empty. Boundary and initial knowledge: at the start, the level is 40 centimetres. Asymptotic knowledge: as the tank nearly empties, the outflow shrinks toward zero. A mechanistic skeleton: the level falls at a rate set by the outflow, and only the outflow law is unknown. And finally, hypotheses from experts or the literature: Torricelli's law suggests a square root. Eight kinds of knowledge, and they're mathematically different objects. Lump them all into one penalty, and later you can't tell which one did the work. Two more distinctions help. Some knowledge is universal: any physical equation must be dimensionally consistent. Some is specific to one system and one regime: this tank, this range of levels. And some knowledge restricts the form of an equation, like no logarithm of a length. Other knowledge restricts its behaviour, like a level that never rises.

2:29

One rule, four ways to use it. Part two: one piece of knowledge, four ways to use it. Take the rule: the level never rises, and never goes below empty. Hard: candidates that break the rule are rejected, or can't even be built. Soft: breaking it adds a penalty to the score. Preferential: the rule tilts which candidates get proposed or ranked first, with no guarantee. Post-hoc: search first, and throw away the violators at the end. Hard gives the most consistency, but locks out the truth if the knowledge is wrong. Soft tolerates approximate knowledge, but needs a weight. Post-hoc is easy, and wastes effort on hopeless regions. Let's try the soft version on our cubic. We add a penalty for any rise, and for any level below zero, over the next four minutes. Even a tiny weight changes the picture. Inside the minute of data, the fit is just as good: still within two millimetres. But after three minutes, the cubic now says about 6 centimetres, close to Torricelli. Knowledge that agrees with the data costs almost nothing where the data are, and repairs the predictions where they aren't. Here's a question. Should every piece of knowledge become a hard rule? Pause and think about what could go wrong. It depends on how sure you are. A useful order of confidence: mathematical necessity, then well established physical principles, then theory for one regime, then empirical regularities, then expert hunches, and last, suggestions from a machine. Adding seconds to metres is structurally wrong, so a hard rule is safe. A trend seen only in your measured range deserves a soft or range-limited check. A constraint suggested by a language model deserves even less authority. Match the mode to the confidence, and write down which is which. Knowledge can also act at different moments: while a formula is being built, while it's scored, or when the finished formulas are screened. Building-time rules are the cheapest: an invalid branch is cut before anything is evaluated. Scoring-time rules can keep fit and plausibility as separate objectives, and show the trade-off as a Pareto front.

4:35

Units as executable knowledge. Part three: units, the most executable knowledge of all. Write each quantity's dimensions as a vector of powers of mass, length and time. A water level is zero, one, zero. A flow rate, volume per time, is zero, three, minus one. Gravity's acceleration is zero, one, minus two. Multiplying adds the vectors. Dividing subtracts them. Adding requires them to be equal. And functions like the sine and the exponential need the zero vector inside. Units become a type system that runs at every node. Checked while a tree is being built, a unit rule stops invalid branches before they cost a single evaluation.

5:15

Dimensionless groups. But units can do more than reject formulas. They can shrink the problem itself. The drain time of our tank depends on four quantities: the starting level h, gravity g, the hole area a, and the tank area A. Together with the time T, that's five, built from two base dimensions, length and time. Put their exponents in a two by five matrix. Any product of powers whose exponents lie in the matrix's null space has no units at all. Five quantities, rank two, so three independent dimensionless groups. One choice: T times the square root of g over h. The area ratio, a over A. And A over h squared. So the law must say: the first group equals some function of the other two. Three variables instead of five, before we've seen any data. Let's test it. We simulated forty drain experiments with different levels, holes and tanks, with two percent timing noise. Plotted raw, drain time against starting level, the points scatter everywhere. Plotted as the first group against the area ratio, on log scales, they fall onto one line. Its slope is minus 1.00. Its constant is 2.31, and Torricelli's law with our discharge coefficient gives 2.36. The third group turns out not to matter at all. Units told us which variables to combine. The data told us the shape of the function. The choice of groups isn't unique. T squared times g over h is just as dimensionless. Equivalent groups can make the search easier or harder, so choosing them is a modeling decision, not paperwork. And beware of a look-alike. Subtracting the mean and dividing by the standard deviation makes a number unitless, but not physically dimensionless. Its meaning depends on the centre and the scale you chose. A law found in standardized variables has to be transformed back before you read any physics into it.

7:02

Recap. Let's recap. Knowledge comes in kinds: units, conservation, symmetry, shape, boundary values, limits, skeletons and hypotheses. Each can enter as a hard rule, a soft penalty, a preference, or a final screen. Match the mode to your confidence. Units are the most executable knowledge: they type-check every node, and dimensional analysis can turn five variables into three groups before you collect any data. In this module's lab, you'll tag variables with units, watch candidates get rejected, find dimensionless groups, and slide between hard and soft rules. Next video: conservation, symmetry, shape, and partial models.

Interactive lab

Units guard

Check drain-time formulas for a draining tank against their units, find dimensionless groups from a null space, slide a rule from soft to hard, and climb the knowledge ladder on your own simulated tanks.

The tank is simulated in your browser (Torricelli's law with a made-up discharge coefficient of 0.6). Four challenges are checked as you go.

Simple math

A tank drains through a small hole

Water leaves at about Cd·√(2gh). In this simulation Cd = 0.6, a typical but made-up value. Everything runs in your browser; your draws of noise and tanks differ from the ones in the videos.

Units as types
[T] = time · [g] = L/T² · [a] = L²

A drain-time formula must come out as a time. Products add powers; sums need equal units.

Dimensionless groups
exponents in the null space

Five quantities with two base dimensions leave three groups. The law must link the groups.

Hard or soft
fit + λ·(rises² + negatives²)

A rule can be a penalty with a weight λ, or (with a huge weight) a hard limit.

A · The units guard

Type a formula for the drain time T using h, g, a, A (and d, nu, rho if you like), or try one of these.

–

B · Dimensionless groups

Pick the quantities you think matter. The page builds their dimension matrix and an integer basis of its null space.

C · Hard or soft

A cubic fitted to one minute of level readings (shaded), with a penalty for any rise or any level below empty between 0 and 240 s. Orange: the cubic; blue dashed: Torricelli's law, the truth here.

0

Fit inside the minute
–
Level at 3 min
–
Lowest level, 0–240 s
–

D · The ladder

Forty small tanks (levels 20–60 cm, holes 4–10 mm) are timed; the rungs then predict ten big ones (up to 2 m, holes up to 2 cm).

2%

Rung 0 fits a quadratic in level, hole and tank size (10 constants). Rung 1 fits a power law in the groups T·√(g/h), a/A and A/h². Rung 3 fixes the small-hole scaling and fits one constant.

Challenges

Each one is checked on your current settings.

  1. Write a drain-time formula that passes the units guard but is not Torricelli's shape: units are a filter, not a validation.
  2. Choose quantities that leave exactly two dimensionless groups, with the drain time T in one of them.
  3. Find readings where the plain cubic goes below empty, then pick the smallest soft weight (not hard) that keeps the lowest level above −1 cm and the fit inside under 2.5 mm.
  4. With at least 10% timing noise, show that rung 3 still recovers Cd within 3% of 0.6.