Skip to content

Evaluate a binomial with a whole upper argument and a fractional lower one - #2211

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-binomial-with-a-whole-upper-and-a-fractional-lower-argument-is-evaluated
Oct 29, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-binomial-with-a-whole-upper-and-a-fractional-lower-argument-is-evaluated

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

binomial(n, k) with a whole n and a k that is not whole was left as written, so EvalNumerical threw CannotEvalException. The gamma ratio was guarded to an n that is not an integer, against what #1411 says the node does: "a k that is not whole evaluates numerically through the gamma function and has no value where n is a negative whole number".

  • A whole n >= 0 goes through the gamma ratio as any other n does: binomial(3, 1/2) is 32/(5 pi).
  • A negative whole n, a pole of Γ(n + 1), has no value, as the node's domain condition already says: NaN.

Found while measuring evaluation for #2195's compiled forms.

EvalNumerical 2.6.0 now
binomial(3, 1/2) CannotEvalException 2.0371832715762602978…
binomial(-3, 1/2) CannotEvalException NaN

Tests: four values against mpmath to 25 digits (binomial(3, 1/2), (0, 1/2), (4, 3/2), (3, -1/2)), and NaN at (-3, 1/2). Full suite 17903/0, interactive trio, AOT smoke 66/0, all frameworks build (on the master before #2209; the chain runs on this branch).

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

…r one

binomial(n, k) with a whole n and a k that is not whole was left as
written, and EvalNumerical threw: the gamma ratio was guarded to an n
that is not an integer. It is Γ(n + 1)/(Γ(k + 1) Γ(n - k + 1)) for any
n, and binomial(3, 1/2) is 32/(5 pi). For a negative whole n, a pole of
Γ(n + 1), it has no value, as the node's domain condition says, and is
NaN.

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 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.57%. Comparing base (4db6c18) to head (051e52a).

Files with missing lines Patch % Lines
...nuous/Evaluation.Continuous.Arithmetics.Classes.cs 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2211   +/-   ##
=======================================
  Coverage   86.57%   86.57%           
=======================================
  Files         302      302           
  Lines       67045    67048    +3     
  Branches    19469    19470    +1     
=======================================
+ Hits        58045    58049    +4     
+ Misses       4897     4896    -1     
  Partials     4103     4103           
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.13% <80.00%> (+<0.01%) ⬆️
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 Δ
...nuous/Evaluation.Continuous.Arithmetics.Classes.cs 86.65% <80.00%> (-0.08%) ⬇️

... and 8 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 f3272dc into master Oct 29, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Oct 29, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-binomial-with-a-whole-upper-and-a-fractional-lower-argument-is-evaluated branch October 29, 2026 22:04
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