Skip to content

The combinatorial functions compile - #2213

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
the-combinatorial-functions-compile
Oct 29, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
the-combinatorial-functions-compile

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #2195, item 3: the binomial coefficient, the falling and the rising factorial and the double factorial compile, in FastExpression and in the LINQ compiler.

Each was refused by both. They compile now in double precision, in Numerics/CombinatorialFunctions, on the interpreter's terms:

FastExpression has an instruction for each. The LINQ compiler has a Complex and a double definition in the generated MathAllMethods, widened to double first as the special functions are.

2.6.0 now
binomial(x, 2), Compile("x").Call(5) UncompilableNodeException 10
binomial(x, 1/2), Compile<double, double> at 3 UncompilableNodeException 2.037183271576257

fallingfactorial, risingfactorial and n!! are new since 2.6.0, and compile from the start.

Tests: CombinatorialCompilationTest compiles each of the three two-argument functions three ways: FastExpression, LINQ over Complex, and LINQ over double for real values. Each is compared with evaluation at every pair of 14 arguments: whole ones from -3 to 5, halves, 9/4, 1 + i and i/2. A pair evaluation leaves unevaluated is counted rather than claimed, and at least three quarters of the pairs are compared. n!! is compared the same way. UserInvalidExceptions pinned binomial(x, 2) as having no compiled form, and pins polygamma(1, x) instead. Full suite 17933/0 after that change, interactive trio, AOT smoke 68/0, all frameworks build.

Still open on #2195: gamma(a, z), polygamma and the newer special functions, the integer functions, and item 4.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

binomial, fallingfactorial, risingfactorial and n!! were refused by
both compilers. Each compiles now, in double precision and on the
interpreter's terms, in CombinatorialFunctions: a whole order is a
product, and the reciprocal of one for a negative order, and any other
goes through the gamma function, with NaN at a pole of the numerator
and 0 at one of the denominator. The double factorial has no value off
the whole numbers or at a negative even one. FastExpression has an
instruction for each, and the LINQ compiler a Complex and a double
definition. Both are checked against evaluation over every pair of
fourteen whole, half-whole and complex arguments.

Part of #2195

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Oct 29, 2026
@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.66055% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.60%. Comparing base (e59e609) to head (117dfc3).

Files with missing lines Patch % Lines
...gouriMath/Functions/Compilation/IntoFE/Compiler.cs 78.94% 4 Missing ⚠️
...ces/AngouriMath/Numerics/CombinatorialFunctions.cs 94.73% 1 Missing and 2 partials ⚠️
...h/Functions/Compilation/IntoLinq/MathAllMethods.cs 93.75% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2213      +/-   ##
==========================================
+ Coverage   86.57%   86.60%   +0.02%     
==========================================
  Files         302      303       +1     
  Lines       67059    67168     +109     
  Branches    19472    19495      +23     
==========================================
+ Hits        58055    58168     +113     
+ Misses       4899     4895       -4     
  Partials     4105     4105              
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.15% <92.66%> (+0.02%) ⬆️
fsharp 32.97% <ø> (ø)
interactive 40.72% <ø> (ø)

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

Files with missing lines Coverage Δ
...ath/Functions/Compilation/IntoFE/FastExpression.cs 96.17% <100.00%> (+0.20%) ⬆️
...ctions/Compilation/IntoLinq/CompilationProtocol.cs 90.72% <100.00%> (+0.24%) ⬆️
...h/Functions/Compilation/IntoLinq/MathAllMethods.cs 70.11% <93.75%> (+1.13%) ⬆️
...ces/AngouriMath/Numerics/CombinatorialFunctions.cs 94.73% <94.73%> (ø)
...gouriMath/Functions/Compilation/IntoFE/Compiler.cs 86.53% <78.94%> (-0.50%) ⬇️

... 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 9164e15 into master Oct 29, 2026
36 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the the-combinatorial-functions-compile branch October 29, 2026 23:32
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Oct 29, 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