Repository navigation
Dimensional analysis of a formula: MathS.Dimensions.Of and DimensionlessGroups, with a page - #2490
Merged
Merged
Conversation
Given the dimension of each variable over the seven SI base dimensions, MathS.Dimensions.Of says whether a formula is physically meaningful, what dimension it has, and which subexpression breaks it and why. The verdict is three-valued: Undetermined, for an undeclared variable, a node the check does not read, or a dimensional base raised to an unknown power, is not a guess. Nothing is simplified first, and a literal 0 or oo fits any dimension where it is added or compared. MathS.Dimensions.DimensionlessGroups gives a basis of the Buckingham pi groups from the exact null space of the dimension matrix, in smallest whole powers, each checked to be dimensionless before it is returned. The dimension map is passed rather than attached to variables, so printing, parsing and simplification are unchanged and the type layer of #1237 is not pre-empted. No clause of Packaging.md section 4 fires, so it is kernel code. No existing answer changes. Measured: UnitTests 18258 passed, 13 skipped, 0 failed (net10.0); FSharpWrapperUnitTests 134 passed; kernel builds warning-free on netstandard2.0, net8.0 and net10.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oups AGENTS.md: an operation the library offers by name is an entry of the catalogue. The two queries answer what MathS.Dimensions.Of and DimensionlessGroups answer, which CatalogueTest checks on an input where the two dimension answers differ. No surface offers them yet: the MCP server's Tools.NotOffered and the terminal's OneShot.notOffered list them, pointing at #2298, which proposes am_dimensions. Part of #2292. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The walk named no node types added since it was written, and read any Function it did not name as a function of pure numbers: dot, cross, det, trace, transpose, a matrix entry and norm were each taken for transcendental. Every arm now names a concrete node type and the last one reports Undetermined, so a node added later is not read as a pure number by default. DimensionsTest.EveryNodeTypeHasADecidedReading lists the verdict on a sample of every concrete node type and fails, by name, on one it does not list. The new rules: dot and cross multiply dimensions; norm, trace, transpose and a matrix entry keep the entries' dimension; a matrix is read where its entries share one and is undetermined where they do not; det of a written n by n matrix is D^n; partialderivative divides by the slot's dimension; a product over 1..n of dimension D is D^n for written bounds; zeta, beta, the exponential and error integrals, W, polygamma, gcd/lcm and the rest of number theory, the connectives and iverson take pure numbers. A variable ranging over a set (a sum or product over a set, max/min, forall/exists, x in S, argmax, indexed unions) takes the dimension the set's members share; a number set fits a declared variable of any dimension and makes an undeclared one a pure number. A set on its own, lambda and application stay undetermined. Docs/Usage/Dimensions.md has the rules and the issue's examples, the water wave among them; its four samples pass docsamples. A BREAKING entry records the new entry point, as #2470 did for the shaders. Part of #2292. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2490 +/- ##
==========================================
- Coverage 86.92% 86.91% -0.01%
==========================================
Files 331 336 +5
Lines 73195 73567 +372
Branches 21326 21411 +85
==========================================
+ Hits 63622 63938 +316
- Misses 5151 5180 +29
- Partials 4422 4449 +27
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MathS.Dimensions.Of(expr, dims)andMathS.Dimensions.DimensionlessGroups(vars, dims): given the dimension of each variable over the seven SI base dimensions, with rational exponents, say whether a formula is physically meaningful, what dimension it has, and where it stops making sense; and give the Buckingham π groups of a set of variables. The design as #2292 sets it out: the dimension map is passed, not attached to variables, so nothing about printing, parsing or simplification changes; the answer isConsistent(with the dimension),Inconsistent(with the subexpression and why) orUndetermined(an undeclared variable, a node it does not read, a dimensional base to a symbolic power), never a guess; nothing is simplified first; a literal0oroofits any dimension where added or compared. Kernel placement per Packaging.md §4: no dependency, nothing on a default path.Three commits, meant to be merged as they are (rebase, not squash):
MathS.Dimensions.OfandDimensionlessGroups— fromfeat/dimensional-analysis, rebased onto master.dimensionanddimensionless_groups, not offered by the terminal or the MCP server yet (The MCP server and the terminal should offer dimensional analysis and shader source once #2292 and #2293 land #2298), as the shaders are not.dot,cross,det,trace,transpose, an entry andnormcount as transcendental:dot([h, d], [v, v])came back inconsistent where it is L²T⁻¹. Every arm now names a concrete node type and the last one isUndetermined;EveryNodeTypeHasADecidedReadingbuilds a sample of every concreteEntitytype by reflection and checks its verdict, so a new node fails it by name.mod,max,min(a literal0oroofits any)dot,crossUndeterminedabs,conjugate,re,im,trace,transpose,norm, an entryerf…,zeta,beta, gamma functions, combinatorial and number-theoretic functions, statementspartialderivative) divides by the variable's dimension to the n-th power; an integral multiplies by it and checks the bounds; a limit checks its pointUndeterminedargmax/argmin,lambda, application, and any future node:UndeterminedThe π groups, each checked by hand, run back through
Of(allConsistent: 1), and counted against n − rank: the pipe,mu / (rho * v * d), 1 group; the pendulum,g * t ^ 2 / l, 1; drag,F / (rho * v ^ 2 * d ^ 2)andmu / (rho * v * d), 2; water waves,k * A,k * h,k * g * t ^ 2, 3.omega^2 = g k tanh(k h)isConsistent: 1, and the shallow-water slipA sin(k x - sqrt(g k h) t)is inconsistent at the phase, L^(1/2) against 1.Docs/Usage/Dimensions.md: the rules and the free-fall, Reynolds and water-wave examples; its 4 samples passdocsamples.BREAKING-CHANGES.md: a "Not silent: a new entry point" entry, as #2470's. No existing answer moves.DimensionsTest: 63 cases. Full check on this commit: 21,102 unit tests, 0 failed; MCP 459, Terminal 69, F# 135, Interactive 19; AOT OK; BoundCheck 0 disagreements, RootCheck 596/596, CasBench 120/121 with 0 wrong, PropCheck clean, SimpSweep 10463/10463, RuleCheck clean, CanonCheck, Confluence and the Modenov corpus at their baselines.Closes #2292.
🤖 Generated with Claude Code