Repository navigation
Sum of kⁿ·rᵏ/k! over k ≥ a is eʳ times the Touchard polynomial (Dobiński's formula e·Bₙ at r = 1) minus the terms below a, and a polynomial over k! is the sum of its terms - #577
Open
enumeratio wants to merge 1 commit into
Conversation
…ski's formula e·Bₙ at r = 1) minus the terms below a, and a polynomial over k! is the sum of its terms; add regression tests. Fix cortex-js#576
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.
Sum(k^3/k!, k = 1..∞)is5e,Sum(k^2·x^k/k!, k = 0..∞)is(x² + x)·eˣ,Sum((k^2 + k)/k!, k = 0..∞)is3e. Fixes #576Rules (
library/utils.ts):touchardSeries(coeff, ratio, n, a), called from thefactorialDenentry ofnamedSeriesClosedFormwhenkPower = n ≥ 1(it returnedundefinedfor anykPower ≠ 0):Σ_{k≥a} c·kⁿ·rᵏ/k! = c·(eʳ·Tₙ(r) − Σ_{k=1}^{a−1} kⁿ·rᵏ/k!),Tₙ(r) = Σⱼ S(n, j)·rʲwith the Stirling numbers of the second kind by their recurrence on bigints. Thek = 0term is 0 forn ≥ 1. Atr = 1it is Dobiński's formula,Tₙ(1) = Bₙ. The sum is entire inr: no guard, and a freerstays symbolic.k!(infiniteSumClosedForm): a body(p₁ + p₂ + …)/k!is the sum of the closed forms of its terms when every term has one (the sum is entire, so the pieces add with no convergence condition). It is tried only for the denominatork!, so no geometric or p-series piece with a guard is added up.TOUCHARD_LIMIT = 200fornand for the lower bounda(B₂₀₀is exact on bigints; the polynomial in a freerhas 200 terms). Past it, and for a negative power ofk(Σ 1/(k·k!), which involvesEi),undefined, and the sum is what it was.evaluate()andsimplify()give the closed form (the same route);.N()evaluates it at the working precision (13.5914091422952261768, where the summed series gave13.591409142296198).Sumover an infinite range is not compiled to a closed form: the compiled loop is unchanged.Wolfram agrees on every value above.
Tests:
test/compute-engine/dobinski-sums.test.ts(new):Σ kⁿ/k!forn = 1…7fromk = 0andk = 1against the Bell numbers (e,2e,5e,15e,52e,203e,877e);Σ k³/k!underevaluate(),simplify()and.N(); ratios1,2,1/2, lower bounds0,1,2,3against the first 40 terms;Σ_{k≥2} k²/k! = 2e − 1; a freex((x³ + 3x² + x)·eˣ); a coefficient; a polynomial numerator (3e,e);n = 150exact;Σ 1/(k·k!)stays a sum. No existing test changed; the 190-odd test files that nameSumwithFactorial,∞orInfinitypass.Overlap with the open PRs. None.