Repository navigation
det, transpose, dot, cross and resultant are functions in an expression - #2180
Merged
Rafael-SOWNet merged 3 commits intoOct 28, 2026
Merged
Rafael-SOWNet merged 3 commits into
Rafael-SOWNet merged 3 commits into
Conversation
Modenov's Problems in Geometry computes areas, collinearity, concurrency and elimination with determinants, vector products and resultants, and none of them could be written in an expression: det(M) was refused by name, transpose(x) and cross(a) were read as products, and dot, a two-vector cross and resultant did not parse. Each is computed from its arguments when it is parsed, since there is no node for any of them: det through Matrix.Determinant, transpose through Matrix.T, resultant through MathS.Polynomials.Resultant, and dot and cross from the components. dot conjugates neither side, as SymPy's dot and Mathematica's Dot do not. cross of two vectors is the vector product in three dimensions, and cross of one vector in the plane is that vector turned through a right angle anticlockwise, as Mathematica's Cross of one vector is, so dot(cross(a), b) is the book's pseudo-scalar product. An argument has to be a matrix or a vector written out, or one once its operations are carried out; anything else throws InvalidArgumentParseException naming the function. Closes #2147. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2180 +/- ##
==========================================
+ Coverage 86.42% 86.44% +0.02%
==========================================
Files 296 296
Lines 65221 65332 +111
Branches 19165 19180 +15
==========================================
+ Hits 56366 56475 +109
- Misses 4804 4805 +1
- Partials 4051 4052 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Rafael-SOWNet
force-pushed
the
det-dot-cross-transpose-and-resultant-in-an-expression
branch
from
October 28, 2026 12:10
ccae548 to
e99f19f
Compare
…library itself Where the fraction-free elimination cannot read the entries as polynomials, Matrix.Determinant took GenericTensor's Laplace expansion, which compiles an expression tree: ILC reports IL3050 on it, and det(M) in the parser made it reachable from every native build, so the C++ wrapper's and the Trimming & NativeAOT jobs failed to publish. The expansion along the first row is now written over the entries. It is the same expansion, needs no lock on GenericTensor's shared scratch matrix, and agrees with GenericTensor's on 60 generated matrices of roots, sines, logarithms and symbols, compared by value. The native smoke test parses a det that takes it, and a dot of a cross. Part of #2147. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
… resultant McpUnitTests checks that angourimath://syntax names every function the grammar accepts. det(x), transpose(x) and cross(x) are now refused with InvalidArgumentParseException, since x is not a matrix, which that test reads as a function of something else, as it reads a count refusal. The refusal's example is the function's own: cross([1, 2, 3], [4, 5, 6]) rather than a matrix. Part of #2147. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Rafael-SOWNet
deleted the
det-dot-cross-transpose-and-resultant-in-an-expression
branch
October 28, 2026 19:21
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.
Modenov's Problems in Geometry computes areas, collinearity, concurrency and elimination with determinants, vector products and resultants. None of them could be written in an expression:
det(M)was refused by name (#2136),transpose(x)andcross(a)were read as products, anddot, a two-vectorcrossandresultantdid not parse.Each is now a function, computed from its arguments when it is parsed, since there is no node for any of them:
det(M)Matrix.Determinanttranspose(M)Matrix.T, which]Twrites only straight after a bracketdot(a, b)dotand Mathematica'sDotcross(a, b)cross(a)cross([x, y])being[-y, x], as Mathematica'sCrossof one vectorresultant(p, q, x)MathS.Polynomials.ResultantThe book's two plane products are then
cross(a), which it writes[a], anddot(cross(a), b), its pseudo-scalar product(a, b)=a_1 b_2 - a_2 b_1. Neither needs a name of its own.An argument has to be a matrix or a vector written out, or one once its operations are carried out:
det(2 * [[1, 2], [3, 4]])is-8. Anything else throwsInvalidArgumentParseExceptionnaming the function:det(A)of a symbol, a non-square determinant, vectors of different lengths, a two-vectorcrossin the plane, aresultantof something that is not a polynomial. The result is as unsimplified as it would be written out by hand:dot([1, 2], [3, 4])is1 * 3 + 2 * 4.det([[1, 2], [3, 4]])det * [[1, 2], [3, 4]]-2transpose([1, 2])transpose * [1, 2][[1, 2]], the rowtranspose(x)transpose * xInvalidArgumentParseExceptioncross([a, b])cross * [a, b][-b, a]dot([1, 2], [3, 4])UnhandledParseException1 * 3 + 2 * 4resultant(x^2 - 1, x - a, x)UnhandledParseExceptiona ^ 2 - 1The
detrow of #2136's breaking entry, which is not released yet, is taken out of it, sincedetis no longer refused. The parser is regenerated with the vendored ANTLR 4.13.1, and the post-processor leaves no generated class public.Docs/Usage/Syntax.mddescribes the functions.The determinant expands itself where the elimination declines. The first CI run failed to publish natively, on the C++ wrapper and in Trimming & NativeAOT:
det(M)in the parser madeMatrix.Determinantreachable from every native build. Where the fraction-free elimination cannot read the entries as polynomials, that falls back to GenericTensor's Laplace expansion, which compiles an expression tree (IL3050). The second commit writes the same expansion along the first row over the entries. It needs no lock on GenericTensor's shared scratch matrix, and it agrees with GenericTensor's on 60 generated matrices of roots, sines, logarithms and symbols, compared by value. The value is unchanged and the printed form can differ, which its own breaking entry records:[[sin(x), cos(x)], [-cos(x), sin(x)]]'s determinant wassin(x) ^ 2 + -cos(x) * -cos(x)and issin(x) ^ 2 - cos(x) * -cos(x). The native smoke test now parses adetthat takes the expansion, and adotof across; published locally with NativeAOT it passes 47 of 47, and the C++ wrapper's native publish reports no warning.The MCP server's syntax document names the five.
McpUnitTestschecks thatangourimath://syntaxnames every function the grammar accepts, and failed for these in the first run. Its check now also acceptsInvalidArgumentParseException, whichdet(x)throws becausexis not a matrix, as it already accepted an argument count refused.Measured
BREAKING-CHANGES.md, then 17233 passed; with the second commit 17234 passed, 0 failed; McpUnitTests 349, TerminalUnitTests 69 and InteractiveWrapperUnitTests 19 passed.ParseEasy0.0% andParseHard−0.2% in allocation, with four more tokens in the lexer.Closes #2147.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura