Skip to content

Refuse norm(v) and beta(x) with one argument, read as products with no error - #2499

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
refuse-one-argument-norm-and-beta
Nov 16, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
refuse-one-argument-norm-and-beta

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #2182.

A call of norm or beta with one argument was read as the product of a variable named for it with its argument, with no error. #2486 kept that reading and left what a one-argument form should mean to #1019. Rafael has now decided to refuse it, the way 2.8.0 refused factorize(…) and the other names in #2453.

Measured, master against this branch:

input master this branch
norm([3, 4]) norm * [3, 4], and [3 * norm, 4 * norm] once simplified throws FunctionArgumentCountException: the length is norm(v, 2), which is abs(v)
beta(x) beta * x throws FunctionArgumentCountException: beta(a, b) takes two arguments
norm(x)^2, 2^beta(x), norm({1, 2}) products refused
norm, norm (x), beta (x) a variable; products unchanged
norm([3, 4], 2), beta(2, 3) 5, 1/12 unchanged

Each message also says to write norm * (…) or beta * (…) where the product was meant.

The refusal is made in Parser.cs, in place of the step that handed a one-argument call back as a name and a bracket, so the grammar is unchanged.

The tests that pinned the old reading now assert the refusal and its message. The MCP server's IsFunction now says yes for both names, and kappa replaces beta in its test and in the library's test of a short name read as a product. Syntax.md describes the refusal in both of its paragraphs, and BREAKING-CHANGES.md has a not-silent entry under Unreleased — since 2.8.0.

Full check: 21,112 of 21,125 unit tests pass (13 skipped). MCP passes 459 of 459, with Terminal, Interactive, F# and the AOT smoke test. All harnesses are clean, and the three baselines match.

Not in this PR: MathS.Parse throws for these refusals as it already does on master for factorize(360) and norm(v, p, q), though it is meant not to throw (#2498). So the MCP server reports such an input as a tool that threw, not as a failed parse. That gets its own fix and MCP tests.

🤖 Generated with Claude Code

…o error

A one-argument call of norm or beta was read as the product of a variable named for it with its
argument: norm([3, 4]) simplified to [3 * norm, 4 * norm], where the length is 5, and beta(x) was
beta * x. Each now throws FunctionArgumentCountException naming what to write: norm(v, 2) for the
length, which is abs(v), and beta(a, b), or norm * (...) and beta * (...) for the product. The
name alone is a variable and with a space before the bracket a product, as the other names
refused by name are. Refused before the grammar, so the grammar is unchanged.

The MCP server's IsFunction now says yes for both, a one-argument call no longer being a
product; kappa takes beta's place in its test, and in the library's test of a short name read
as a product. Syntax.md says both are refused.

Full check: 21112 of 21125 unit tests pass, 13 skipped; MCP 459 of 459; harnesses clean and
the three baselines matched. MathS.Parse throwing for these, as it already does for
factorize(360), is #2498.

Part of #2182

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.90%. Comparing base (dce1653) to head (c43a9d4).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2499   +/-   ##
=======================================
  Coverage   86.90%   86.90%           
=======================================
  Files         336      336           
  Lines       73587    73587           
  Branches    21419    21419           
=======================================
  Hits        63951    63951           
  Misses       5188     5188           
  Partials     4448     4448           
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.42% <100.00%> (ø)
fsharp 32.79% <ø> (ø)
interactive 40.09% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
Sources/AngouriMath/Core/Parser.cs 82.26% <100.00%> (ø)

... and 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Rafael-SOWNet
Rafael-SOWNet merged commit 0cfc9ec into master Nov 16, 2026
37 of 38 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the refuse-one-argument-norm-and-beta branch November 16, 2026 18:47
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant