"Counting in their heads" - 1895 oil painting
08-11-2020, 05:07 PM (This post was last modified: 08-11-2020 08:51 PM by Albert Chan.)
Post: #18
 Albert Chan Senior Member Posts: 2,347 Joined: Jul 2018
RE: "Counting in their heads" - 1895 oil painting
(08-11-2020 12:43 PM)Gerson W. Barbosa Wrote:  sum-of-n-squares = n(c² + d²(n² - 1)/12)
sum-of-n-cubes = nc(c² + d²(n² - 1)/4)

Considering the similarities between both formulae, perhaps they somehow can be generalized
for all positive integer powers.

Perhaps this explain the similarity, for Sp = ap + (a+1)p + ... + bp, b = a+n-1
With center c = (a+b)/2, g = (n-1)/2 = b-c = c-a, we have

﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿S(a,n) = S(c,b-c+1) - S(c,a-c)
﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ = S(c,g+1) - S(c,-g)
﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ = Finite-Difference-Diagonals • $$\left( [\binom{g+1}{1},\binom{g+1}{2},\cdots] - [\binom{-g}{1},\binom{-g}{2},\cdots] \right)$$

Let's see what the combinatorial coefficients look like:

XCas> g := (n-1)/2
XCas> coef := makelist(r -> simplify(comb(g+1,r) - comb(-g,r)),1,6)

﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿→ $$\Large [n,\,0,\,\frac{(n^{3}-n)}{24},\,\frac{(-n^{3}+n)}{24},\,\frac{(n^{5}+70\cdot n^{3}-71\cdot n)}{1920},\,\frac{(-n^{5}-30\cdot n^{3}+31\cdot n)}{960}]$$

coef(1) = n, which make first term of Sp = c^p*n
coef(2) = 0, which make the central element based formula compact (Δf * 0 = 0)
coef(3) = -coef(4), which meant dot-products have this common factor.

Finite Difference table for (c+x)² and (c+x)³ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ ﻿// note: [1,0,0] ≡ c², [1,2,1] ≡ c²+2c+1

Code:
x (c+x)^2 0 [1,0,0]      1 [1,2,1]     [2,1] 2 [1,4,4]     [2,3]        x (c+x)^3 0 [1,0,0,0] 1 [1,3,3,1]   [3,3,1] 2 [1,6,12,8]  [3,9,7]     [6,6] 3 [1,9,27,27] [3,15,19]   [6,12]      

If we let k = coef(3) = (n³-n)/24:

sum-of-n-squares = c^2*n + 2k
sum-of-n-cubes ﻿ ﻿ ﻿ = c^3*n + (6c+6)*k + 6*(-k) = c*(c^2*n + 6k)

coef(4) and coef(5) are not close, which meant similarity ends after cubes

XCas> sumpow(p) := expand(simplify(sum(x^p, x=c-g .. c+g)))
XCas> for(p=1; p<6; p++) {print(p, sumpow(p))}

1, c*n
2, (n^3)/12+c^2*n-n/12
3, (c*n^3)/4+c^3*n-(c*n)/4
4, (n^5)/80+(c^2*n^3)/2+c^4*n-(n^3)/24-(c^2*n)/2+(7*n)/240
5, (c*n^5)/16+(5*c^3*n^3)/6+c^5*n-(5*c*n^3)/24-(5*c^3*n)/6+(7*c*n)/48
 « Next Oldest | Next Newest »