Repository navigation
The falling and the rising factorial - #2194
Merged
Merged
Conversation
fallingfactorial(x, n), also factorialpower(x, n), Mathematica's name, and risingfactorial(x, n) were reserved by name in #2184 and are now Entity.FallingFactorialf and Entity.RisingFactorialf, built by MathS.FallingFactorial and MathS.RisingFactorial. For a whole n >= 0 they are x (x - 1) ... (x - n + 1) and x (x + 1) ... (x + n - 1), x to the n falling and rising, computed exactly for any number x. For a negative whole n they are the reciprocals of (x + 1) ... (x - n) and (x - 1) ... (x + n), (2.52) in Graham, Knuth and Patashnik's Concrete Mathematics, with no value where a factor vanishes. For any other n they are Gamma(x + 1)/Gamma(x - n + 1) and Gamma(x + n)/Gamma(x), as Mathematica's FactorialPower and Pochhammer are, evaluated numerically: no value at a pole of the numerator, and 0 at one of the denominator. fallingfactorial(5, 1/2) agrees with mpmath to 1e-20. risingfactorial(x, n) is fallingfactorial(x + n - 1, n), and binomial(n, k) is fallingfactorial(n, k)/k!. They draw with Knuth's bars, x^{\underline{n}} and x^{\overline{n}}, and export to SymPy's ff and rf. A conjugate as the whole exponent of a power is drawn in brackets, x^{\left(\overline{n}\right)}, since x^{\overline{n}} is the rising factorial. pochhammer stays refused, (x)_n being the rising factorial to some authors and the falling one to others. Part of #2182. 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 #2194 +/- ##
=======================================
Coverage 86.54% 86.55%
=======================================
Files 297 297
Lines 66349 66431 +82
Branches 19273 19289 +16
=======================================
+ Hits 57425 57498 +73
- Misses 4854 4861 +7
- Partials 4070 4072 +2
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.
fallingfactorial(x, n)(alsofactorialpower, Mathematica's name) andrisingfactorial(x, n)were reserved in #2184 and are now functions. Part of #2182.nx^{\underline{n}}x^{\overline{n}}>= 0x (x - 1) ... (x - n + 1)x (x + 1) ... (x + n - 1)< 01 / ((x + 1) ... (x - n))1 / ((x - 1) ... (x + n))Γ(x + 1) / Γ(x - n + 1), numericallyΓ(x + n) / Γ(x), numericallyThe whole orders follow Concrete Mathematics (2.52), and the other orders follow Mathematica's
FactorialPowerandPochhammer. A pole of the numerator has no value, and a pole of the denominator gives0.fallingfactorial(5, 1/2)agrees with mpmath to 1e-20. The tests also checkrisingfactorial(x, n) = fallingfactorial(x + n - 1, n)andbinomial(n, k) = fallingfactorial(n, k) / k!.LaTeX uses Knuth's bars, and SymPy output is
ffandrf. A conjugate that is the whole exponent of a power is now drawn in brackets,x^{\left(\overline{n}\right)}, so it cannot be read as a rising factorial.pochhammerstays refused."fallingfactorial(5, 2)".ToEntity().Simplify()UnhandledParseException20"risingfactorial(3, 2)".ToEntity().Simplify()UnhandledParseException12"fallingfactorial(5, 1/2)".ToEntity().EvalNumerical()UnhandledParseException2.29257989505120015013822761269...🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura