A drain-time formula must come out as a time. Products add powers; sums need equal units.
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.
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.
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
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.
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.
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.
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.
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.
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.
Forty small tanks, one big question. Forty small tanks, drained and timed. Now predict a big one: two metres of water, a hole two centimetres wide. How much should you trust your formula? We'll climb a ladder of knowledge one rung at a time, and measure what each rung buys. On the way up: conservation, symmetry, shape, limits, partial models, and what happens when the knowledge is wrong.
Conservation and balance. Part one: conservation. Many laws say that something changes only through flows in and out, and through sources and sinks. For the tank, the rate of change of the water volume equals the inflow minus the outflow. Spread over space and time, the same idea becomes a density, a flux, and a source. Written for a whole region, a balance lets you integrate instead of differentiate. And with noisy data, integrating is gentle, while differentiating amplifies the noise. Let's measure that. Seventy six level readings, one every two seconds, with two millimetres of noise. We want the outflow law: the level falls at a rate proportional to h to some power p. The truth is one half. Estimate the slope at each reading by finite differences, then fit: p comes out 0.55. Fit whole simulated level curves instead: p comes out 0.496. The discharge coefficient comes out 0.59; the true value is 0.6. Same data, same law. Integrating the model beat differentiating the data. Conservation can be a penalty on a residual, or it can be built into the form, so that a violation can't even be written. When a property is exact, building it in usually beats punishing it again and again. Sometimes you only know that something is conserved, not what. Take a frictionless pendulum. Is there a combination of the angular speed squared and the cosine of the angle that stays constant? We searched for the constant c in omega squared plus c times cosine theta that varies least along four simulated swings. The best value is minus 19.6. Twice g over the length is 19.62. That's energy, found from trajectories alone.
Symmetry and coordinates. Part two: symmetry. A symmetry says that changing the description shouldn't change the law. For a scalar, like a potential energy, invariance means the value doesn't change when you rotate the coordinates. For a vector, like a force, equivariance means it rotates right along with them. The cheapest encoding is invariant variables. A central potential written in x and y is k over the square root of x squared plus y squared: ten nodes. Written in the distance r, it's k over r: three nodes. Choose coordinates in which the law is simple, and the search gets easier for free. Real systems are rarely perfectly symmetric. A tilted table, a draft, an uneven wall can break the ideal. So instead of deleting every candidate that breaks the symmetry, score how much it breaks it, or allow a small symmetry-breaking term, and let the data decide whether it's needed. Ask not only which expression fits, but in which coordinates the law becomes simple.
Shape, boundaries, limits and skeletons. Part three: shape. Often you know less than a mechanism, but more than nothing: a sign, a trend, a curvature, a bound, a saturation, a period. For our tank: the outflow grows with the level, and grows ever more slowly. We fitted a quartic to outflow measured between ten and forty centimetres. A counterexample search over the declared range, zero to one metre, finds the first violation at 33 centimetres, still inside the data: there the quartic starts bending upward. At one metre it predicts 970 cubic centimetres per second. The truth is 134. Store every shape constraint with the range where you believe it, and how sure you are. A constraint without a range is stronger than you meant. Part four: boundaries, limits and skeletons. Boundary and initial values aren't ordinary data points. They define the problem. You can build a candidate that satisfies them exactly: a known part, plus a factor that vanishes on the boundary, times a piece to discover. Then the search looks only for that piece. Limits say even more. If theory says the outflow grows like the square root of the level, write the candidate as c times the square root of h, plus a correction, and let the search work on the correction. A model can fit the measured range beautifully and still grow at the wrong rate. A single error number can't see that. Often you know the architecture of a law, but not all of it. For the tank: area times the rate of change of the level equals inflow minus outflow. Only the outflow law is unknown. So search for the outflow, not for the whole textbook. A grammar can fix the root as a known part plus an unknown part, and leave only the unknown slot open. Then label every piece of the final equation: fixed in advance, constant fitted, structure discovered, or simplified afterwards. Otherwise your assumptions get reported as the machine's discoveries.
When knowledge is wrong. Question. What's more dangerous: a discovery system with no physics, or one with wrong physics, enforced confidently? Pause and decide. The second. A wrong hard rule makes the truth unreachable, and nothing in the score will tell you. Knowledge goes wrong in ordinary ways: the regime changed, the literature model was approximate, a unit was typed wrong, a symmetry is broken, a variable is missing, or a machine suggested something plausible and false. Two diagnostics. First, the weight path: solve again across a range of weights, and watch what changes. We pulled a flexible outflow model toward a prior. With a correct prior, the square root, the error at levels above the data falls from 44 percent to under 2, while the fit inside loosens only a little, from 0.9 to 1.6 cubic centimetres per second. With a wrong prior, outflow proportional to the level, the error above the data stays between 56 and 59 percent, and the fit inside gets about twelve times worse as the weight grows. A conclusion that holds only at one finely tuned weight isn't a conclusion. Second, ablation: run with no prior, with each prior alone, and with all of them. A constraint that changes nothing is clutter. One that improves the fit inside but ruins extrapolation isn't doing what you hoped. And keep a log of where knowledge came from: papers, prompts, retrieved sources, manual edits. A model trained on millions of formulas may hand you a famous law it remembered, rather than one it inferred.
A ladder of knowledge. Part five: the ladder. Forty simulated small tanks, with levels from 20 to 60 centimetres and holes of 4 to 10 millimetres. Then predict ten big tanks: up to two metres of water, and holes up to two centimetres. Rung zero, data only: a flexible quadratic in level, hole size and tank size, with ten constants. It fits the small tanks to about 11 percent. On the big tanks its error is 174 percent, and eight of the ten predicted drain times are negative. Rung one, units: search only over the dimensionless groups. A power law in the two ratios fits the small tanks to 1.6 percent, and predicts the big ones to 1.8 percent. Rung two, signs and trends: drain times must be positive, and grow with the level and with the tank. The power law already obeys them. The quadratic didn't. Rung three, scaling: for small holes, drain time should be proportional to the area ratio. Fix that exponent and fit a single constant: 1.5 percent on the big tanks, and a discharge coefficient of 0.600. Rung four, the skeleton: keep the volume balance, and search only for the outflow law. From level curves, it comes out as the square root of the level, with a coefficient of 0.59. Rung five, the stress test: remove each piece of knowledge in turn. Without units, the prediction collapses. Without the scaling rung, it barely changes: units had already done that work. Every rung is a modeling decision. Compare it with the rung below, and report what each one bought.
Designing the pipeline. So here's how to design a knowledge-aware pipeline. List every piece of knowledge with its source, its confidence, and the range where it holds. Choose a mode for each: hard for necessities, soft or preferential for regularities and hunches. Run the ablations and the weight paths. And keep the provenance of every term. Let's recap. Conservation can be scored, integrated, or built in, and even an unknown invariant can be found from trajectories. Symmetry is cheapest as invariant variables. Shape constraints need a range and a confidence. Boundaries, limits and skeletons let the search focus on what's actually unknown, as long as you label what was supplied. And wrong knowledge, enforced confidently, is the most dangerous kind. In the lab, you'll climb the ladder yourself. Next module: search and optimization, or how to move through an enormous space.
8:01Video 6 · 3.1Knowledge you can executeA 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.
9:25Video 7 · 3.2Conservation, symmetry, shape and partial modelsOn 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.
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.
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.
Five quantities with two base dimensions leave three groups. The law must link the groups.
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.
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).
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.
- Write a drain-time formula that passes the units guard but is not Torricelli's shape: units are a filter, not a validation.
- Choose quantities that leave exactly two dimensionless groups, with the drain time T in one of them.
- 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.
- With at least 10% timing noise, show that rung 3 still recovers Cd within 3% of 0.6.
