8
$\begingroup$

Is this a bug?

Sum[Binomial[2 n - 1, 2 m - 1]*(L - 2 - 2*(2 m - 1)), {m, 1, n}]

gives

-4^(-1 + n) (1 - L + 2 n)

However, clearly, if n=1, the series is L-4 where m can take the only value of 1.

But the answer computed by Mathematica -4^(-1 + n) (1 - L + 2 n) with n=1 simplifies to L-3?

I am using MMA 14.0 on Windows.

$\endgroup$
2
  • $\begingroup$ Adding GenerateConditions -> True gives the same thing along with n >= 1 which is a bug, but when you dont add that option i wouldn't say a return that works for n > 1 is a bug. $\endgroup$
    – Coolwater
    Commented Feb 26 at 10:07
  • $\begingroup$ Sum and Integrate often give results that whose dependence on parameters is only "generically true" (finite number of exceptions when the parameter is a positive integer). Might always want to check the first couple of values. $\endgroup$
    – Goofy
    Commented Feb 26 at 17:10

2 Answers 2

3
$\begingroup$

You are right in pointing out that the result produced by Mathematica is only correct for n>1. This seems to comes from the term Sum[Binomial[2 n - 1, 2 m - 1](2 m - 1)), {m, 1, n}]. One can evaluate this by writing out the binomial expansions of the derivatives of (1 + x)^(2n - 1) and (1 - x)^(2n - 1), and evaluating the difference at x = 1. The issue arises from the second term which has derivative -(2n - 1)(1 - x)^(2n - 2). The Mathematica result assumes n != 1 and sets this term to 0. However, in the case n = 1, (1 - x)^(2n - 1) = 1 - x, which has derivative -1. For n != 1, say n = 2, (1 - x)^(2n - 1) = 1-3x+3x^2-x^3, the derivative is -3 + 6x - 3x^2 for which the value is 0 at x = 1 and this result holds for all n > 1.

If you enter Sum[Binomial[2 n - 1, 2 m - 1]*(L - 2 - 2*(2 m - 1)), {m, 1, n}, Assumptions -> n == 1], Mathematica does produce L - 4, but not for assumptions such as n >= 1, where the answer you provided is the result.

$\endgroup$
4
$\begingroup$
$Version

(* "14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)" *)

Clear["Global`*"]

sum1[n_Integer?Positive] := 
 Sum[Binomial[2  n - 1, 2  m - 1]*(L - 2 - 2*(2  m - 1)), {m, 1, n}]

sum1[1]

(* -4 + L *)

Generating a sequence,

seq = sum1 /@ Range[8] // Simplify

(* {-4 + L, 4 (-5 + L), 16 (-7 + L), 64 (-9 + L), 256 (-11 + L), 1024 (-13 + L), 
 4096 (-15 + L), 16384 (-17 + L)} *)

Using FindSequenceFunction

sum2[n_] = FindSequenceFunction[seq, n]

enter image description here

The result is a DifferenceRoot

sum2[n] // InputForm

(* DifferenceRoot[Function[{\[FormalY], \[FormalN]}, 
   {16*\[FormalY][\[FormalN]] - 8*\[FormalY][1 + \[FormalN]] + 
      \[FormalY][2 + \[FormalN]] == 0, \[FormalY][1] == -4 + L, 
    \[FormalY][2] == 4*(-5 + L), \[FormalY][3] == 
     16*(-7 + L), \[FormalY][4] == 64*(-9 + L), 
    \[FormalY][5] == 256*(-11 + L), 
    \[FormalY][6] == 1024*(-13 + L), 
    \[FormalY][7] == 4096*(-15 + L)}]][n] *)

Verifying that the DifferenceRoot works beyond the original sequence:

And @@ (Table[sum1[n] == sum2[n], {n, 1, 50}] // Simplify)

(* True *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.