Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: sum of binomials .. bug ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70503] Re: [mg70486] sum of binomials .. bug ?
  • From: Devendra Kapadia <dkapadia at wolfram.com>
  • Date: Wed, 18 Oct 2006 04:16:45 -0400 (EDT)
  • References: <200610170659.CAA02125@smc.vnet.net>

On Tue, 17 Oct 2006, yann_che2 at yahoo.fr wrote:

> Hi everyone,
>
> on Mathematica 5.2 (mac os x), experimenting sums of binomials, i tried
> the following:
>
> In[6]:=   f[k_] := Sum[Binomial[21 - k, i], {i, 0, 10 - k}]
> In[7]:=   x = 3; f[x]
> Out[7]:= 63004
> In[8]:=   Clear[x] ; f[x] /. x -> 3
> Out[8]:= 262144
> In[9]:=   Clear[x] ; f[x]
> Out[9]:= 2^(21-x)
>
>
> does anyone know why Out[7] and Out[8] give different results ? do you
> think it is a bug ? i searched everywhere in the forums but couldn't
> find anything that helped.
> do you have a clue ?
>
> yann
>

Hello Yann,

Thank you for reporting the inconsistent answers in the
binomial sum given above.

The answer 2^(21-x) for f[x] in your example is incorrect.

Sums of this type are often evaluated by rewriting them in terms
of infinite hypergeometric series. The incorrect answer occurs
during this conversion.

A partial workaround for the problem is to replace the upper
limit '10-k' by 'a-k' as shown below. Using this method, we
recover the missing Hypergeometric2F1 term in the answer in
Out[5].

=============================

In[1]:= $Version

Out[1]= 5.2 for Linux (June 27, 2005)

In[2]:= f1[k_] := Sum[Binomial[21 - k, i], {i, 0, a-k}]

In[3]:= x=3;a=10;f1[x]

Out[3]= 63004

In[4]:= Clear[x, a];f1[x]/.{x-> 3, a-> 10}

Out[4]= 63004

In[5]:= f1[x]//InputForm

Out[5]//InputForm=
2^(21 - x) - (Gamma[22 - x]*Hypergeometric2F1[1, -20 + a, 2 + a - x, -1])/
   (Gamma[21 - a]*Gamma[2 + a - x])

================================

I apologize for the confusion caused by this problem.

Sincerely,

Devendra Kapadia,
Wolfram Research, Inc.


  • Prev by Date: Re: sum of binomials .. bug ?
  • Next by Date: Re: save value in array during loop
  • Previous by thread: sum of binomials .. bug ?
  • Next by thread: Re: sum of binomials .. bug ?