# Finding Closed form expressions for sums

I am working with the a problem where I need to compute some complicated sums, for which I first define the following inner product.

    ClearAll[CircleDot]

Ket /: CircleDot[Bra[x__], Ket[y__]] :=

BraKet[x_, y_] := Bra[x]\[CircleDot]Ket[y]

CircleDot[e1_, HoldPattern[Plus[e2__]]] :=
Total@Map[CircleDot[e1, #] &, {e2}]

CircleDot[HoldPattern[Plus[e1__]], e2_] :=
Total@Map[CircleDot[#, e2] &, {e1}]

CircleDot[first_, HoldPattern[Times[x__, Ket[y__]]]] :=
Times[x, CircleDot[first, Ket[y]]]

CircleDot[HoldPattern[Times[x__, Bra[y__]]], last_] :=
Times[x, CircleDot[Bra[y], last]]


Now, in general the sums that I am interested in take the following form.

(1 + z*zb)^(-2 j)
CircleDot[Sum[zb^n*Bra[n], {n, 0, 2 j}],
Sum[Ket[m] z^m*(2 j)!/(n! (2 j - n)!), {m, 0, 2 j}]]


Mathematica wasn't too keen on computing the sum for arbitrary upper limit $$2j$$ which was fine, I just took too putting some numbers in for it and guessing a pattern and doing some induction to write up closed form expressions. For example, one of the terms looks like

    (1 + z*zb)^(-2 j)
CircleDot[Sum[zb^n*Bra[n], {n, 0, 2 j}],
Sum[Ket[m + 1] z^m*((2 j)!*(2 j - m))/((m)! (2 j - m)!), {m, 0,
2 j}]] //


After shifting some indices, and letting $$2j = 2,3,4,..$$ I was able to guess a closed form for this $$\frac{2j*z_b}{1+z*z_b}$$. This strategy has worked for almost all but a few terms are particularly bothersome, and that brings me here.

An example would be

    (1 + z*zb)^(-2 j)
CircleDot[Sum[zb^n*Bra[n], {n, 0, 2 j}],
Sum[Ket[m] z^m*((2 j)!*(m - j)^3)/(m! (2 j - m)!), {m, 0, 2 j}]]


For this I did make some progress by guessing a few values, and arranging it in the form $$\frac{j^3(z*z_b-1)^3+r(j)*(z*z_b-1)z*z_b}{(z*z_b+1)^3}$$, where $$r(j) = 4,20,48,88,700..$$ for $$2j = 2,4,6,8,10$$ respectively. Again, no discernible pattern as a polynomial in $$j$$ for this series. So perhaps not the right way to do it?

Other terms are even more pathological. Some where I have made no progress look like a)

(1 + z*zb)^(-2 j)
CircleDot[Sum[zb^n*Bra[n], {n, 0, 2 j}],
Sum[Ket[m] z^(
m - 1)*((2 j)!*((m - 1) -
j)^2*(2 j - (m - 1)))/((m - 1)! (2 j - (m - 1))!), {m, 1,
2 j + 1}]]


b)

(1 + z*zb)^(-2 j)
CircleDot[Sum[zb^n*Bra[n], {n, 0, 2 j}],
Sum[Ket[m] z^(
m - 1)*((2 j)!*((m - 1) -
j)^3*(2 j - (m - 1)))/((m - 1)! (2 j - (m - 1))!), {m, 1,
2 j + 1}]]


c)

    (1 + z*zb)^(-2 j)
CircleDot[Sum[zb^n*Bra[n], {n, 0, 2 j}],
Sum[Ket[m] z^(
m + 1)*((2 j)!*((m + 1) -
j)^3*(2 j - (m + 1)))/((m + 1)! (2 j - (m + 1))!), {m, 0,
2 j - 1}]]


d)

(1 + z*zb)^(-2 j)
CircleDot[Sum[zb^n*Bra[n], {n, 0, 2 j}],
Sum[Ket[m] z^(
m + 1)*((2 j)!*((m + 1) -
j)^2*(2 j - (m + 1)))/((m + 1)! (2 j - (m + 1))!), {m, 0,
2 j - 1}]]


Are there any tools mathematical or in Mathematica that can help me address this issue that I am having some trouble with.

Your initial sum is equivalent to:

Sum[zb^n z^m (2j)! (2j-m)/(m! (2j-m)!) KroneckerDelta[n, m+1], {n, 0, 2j}, {m, 0, 2j}]


where I carried out the inner product by hand. Now, rather than trying to compute the double summation directly, one can do the sum in stages:

s = Assuming[
0 <= m <= 2j-1 && j>0 && (m|j) ∈ Integers,
Simplify @ Sum[zb^n z^m (2j)! (2j-m)/(m! (2j-m)!) KroneckerDelta[n, m+1], {n, 0, 2j}]
]


((2 j - m) zb (z zb)^m (2 j)!)/((2 j - m)! m!)

The second summation yields (including the scaling factor):

r = (1+z zb)^(-2j) Sum[s, {m, 0, 2j}]


2 j zb (1 + z zb)^(-1 - 2 j) ((1 + z zb)^2)^j

This can be simplified further. I will use both FullSimplify and FunctionExpand because in later examples, HypergeometricPFQ starts being produced:

Assuming[j ∈ Integers, FullSimplify @ FunctionExpand @ r]


(2 j zb)/(1 + z zb)

Your second example can also be done similarly:

s = Assuming[
0 <= m <= 2j && j>0 && (m|j) ∈ Integers,
Simplify @ Sum[zb^n z^m (2j)! (m - j)^3/(m! (2j - m)!) KroneckerDelta[m,n], {n, 0, 2j}]
];

Assuming[
j ∈ Integers,
FullSimplify @ FunctionExpand[(1 + z zb)^(-2j) Sum[s, {m, 0, 2j}]]
]


(j (-1 + z zb) (-2 z zb + 6 j z zb + j^2 (-1 + z zb)^2))/(1 + z zb)^3

• a:

s = Assuming[
1 <= m <= 2j && j>0 && (m|j) ∈ Integers,
Simplify @ Sum[zb^n z^(m-1) (2j)! ((m - 1) - j)^2 (2j - (m-1))/((m-1)! (2j - (m - 1))!) KroneckerDelta[m,n], {n, 0, 2j}]
];

Assuming[
j ∈ Integers,
FullSimplify @ FunctionExpand[(1 + z zb)^(-2j) Sum[s, {m, 1, 2j+1}]]
]


(2 zb (j^3 + j (-1 - 2 (-2 + j) j) z zb + (-1 + j)^2 j z^2 zb^2))/(1 + z zb)^3

• b. This example causes issues for some reason, so I needed to manually adjust the indexing:

s = Assuming[
1 <= m <= 2j && j>0 && (m|j) ∈ Integers,
Simplify @ Sum[zb^n z^(m-1) (2j)! ((m - 1) - j)^3 (2j - (m-1))/((m-1)! (2j - (m - 1))!) KroneckerDelta[m,n], {n, 0, 2j}]
];

With[{s = s /. m->k+1}, sum = Sum[s, {k, 0, 2j}]];

Assuming[
j ∈ Integers,
FullSimplify @ FunctionExpand[(1 + z zb)^(-2j) sum]
]


(2 j zb (-j^3 + (-1 + j (5 + 3 (-3 + j) j)) z zb - (-2 + j) (2 + 3 (-2 + j) j) z^2 zb^2 + (-1 + j)^3 z^3 zb^3))/(1 + z zb)^4

• c:

s = Assuming[
0 <= m <= 2j-1 && j>0 && (m|j) ∈ Integers,
Simplify @ Sum[zb^n z^(m+1) (2j)! ((m + 1) - j)^3 (2j - (m+1))/((m+1)! (2j - (m + 1))!) KroneckerDelta[m,n], {n, 0, 2j}]
];

Assuming[
j ∈ Integers,
FullSimplify @ FunctionExpand[(1 + z zb)^(-2j) Sum[s, {m, 0, 2j-1}]]
]


(1/zb)2 (1 + z zb)^(-2 (2 + j)) ((j + j z zb)^4 + j (1 + z zb)^( 2 j) (-j^3 + (-1 + j (5 + 3 (-3 + j) j)) z zb - (-2 + j) (2 + 3 (-2 + j) j) z^2 zb^2 + (-1 + j)^3 z^3 zb^3))

• d:

s = Assuming[
0 <= m <= 2j-1 && j>0 && (m|j) ∈ Integers,
Simplify @ Sum[zb^n z^(m+1) (2j)! ((m + 1) - j)^2 (2j - (m+1))/((m+1)! (2j - (m + 1))!) KroneckerDelta[m,n], {n, 0, 2j}]
];

Assuming[
j ∈ Integers,
FullSimplify @ FunctionExpand[(1 + z zb)^(-2j) Sum[s, {m, 0, 2j-1}]]
]


(1/(zb (1 + z zb)^2))(-1 + 2 j^3 - 2 (1 + j^2 (-4 + 3 j)) z zb + (-1 + 2 j)^3 z^2 zb^2 + (1 - 2 j^3) (1 + z zb)^(2 - 2 j) - j (-1 + 2 j) z^2 zb^2 (1 + z zb)^(2 - 2 j) HypergeometricPFQ[{2, 2, 2, 2 - 2 j}, {1, 1, 3}, -z zb])

I don't know how to eliminate the HypergeometricPFQ term here, although I expect that it is possible.

This is a partial answer, i.e., solves three of the five examples.

Clear["Global*"]

ClearAll[CircleDot]

Ket /: CircleDot[Bra[x__], Ket[y__]] :=

BraKet[x_, y_] := Bra[x]\[CircleDot]Ket[y]

CircleDot[e1_, HoldPattern[Plus[e2__]]] := Total@Map[CircleDot[e1, #] &, {e2}]

CircleDot[HoldPattern[Plus[e1__]], e2_] := Total@Map[CircleDot[#, e2] &, {e1}]

CircleDot[first_, HoldPattern[Times[x__, Ket[y__]]]] :=
Times[x, CircleDot[first, Ket[y]]]

CircleDot[HoldPattern[Times[x__, Bra[y__]]], last_] :=
Times[x, CircleDot[Bra[y], last]]


FindSequenceFunction works on the first three examples but fails on the last two.

sum1[j_] := (1 + z*zb)^(-2 j)*
CircleDot[Sum[zb^n*Bra[n], {n, 0, 2 j}],
Sum[Ket[m] z^m*((2 j)!*(m - j)^3)/(m! (2 j - m)!),
{m, 0, 2 j}]] // Simplify

seq1 = sum1 /@ Range[6];

sol1[j_] = FindSequenceFunction[seq1, j] // Simplify

(* (j (-1 + z zb) (-2 z zb + 6 j z zb + j^2 (-1 + z zb)^2))/(1 + z zb)^3 *)

suma[j_] := (1 + z*zb)^(-2 j)*
CircleDot[Sum[zb^n*Bra[n], {n, 0, 2 j}],
Sum[Ket[m] z^(m - 1)*
((2 j)!*((m - 1) - j)^2*(2 j - (m - 1)))/
((m - 1)! (2 j - (m - 1))!),
{m, 1, 2 j + 1}]]

seqa = suma /@ Range[6];

sola[j_] = FindSequenceFunction[seqa, j] // FullSimplify

(* (2 zb (j^3 + j (-1 - 2 (-2 + j) j) z zb + (-1 + j)^2 j z^2 zb^2))/(1 + z zb)^3 *)

sumb[j_] := (1 + z*zb)^(-2 j)*CircleDot[Sum[zb^n*Bra[n], {n, 0, 2 j}],
Sum[Ket[m] z^(m - 1)*
((2 j)!*((m - 1) - j)^3*(2 j - (m - 1)))/
((m - 1)! (2 j - (m - 1))!),
{m, 1, 2 j + 1}]]

seqb = sumb /@ Range[6];

solb[j_] = FindSequenceFunction[seqb, j] // FullSimplify

(* (1/((1 + z zb)^4))2 j zb (-j^3 + (-1 + j (5 + 3 (-3 + j) j)) z zb - (-2 +
j) (2 + 3 (-2 + j) j) z^2 zb^2 + (-1 + j)^3 z^3 zb^3) *)

sumc[j_] := (1 + z*zb)^(-2 j)*
CircleDot[Sum[zb^n*Bra[n], {n, 0, 2 j}],
Sum[Ket[m] z^(m + 1)*
((2 j)!*((m + 1) - j)^3*(2 j - (m + 1)))/
((m + 1)! (2 j - (m + 1))!),
{m, 0, 2 j - 1}]]

seqc = {#, sumc[#]} & /@ Range[2, 10] // FullSimplify;

solc[j_] = FindSequenceFunction[seqc, j] // FullSimplify

(* returns input *)

sumd[j_] := (1 + z*zb)^(-2 j)*CircleDot[Sum[zb^n*Bra[n], {n, 0, 2 j}],
Sum[Ket[m] z^(m + 1)*
((2 j)!*((m + 1) - j)^2*(2 j - (m + 1)))/
((m + 1)! (2 j - (m + 1))!),
{m, 0, 2 j - 1}]]

seqd = {#, sumd[#]} & /@ Range[2, 7] // FullSimplify;

sold[j_] = FindSequenceFunction[seqd, j] // FullSimplify

(* returns input *)
`