MathGroup Archive 2004

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

Search the Archive

Re: Re: Hypergeometric functions and Sum error in 5.01?

  • To: mathgroup at
  • Subject: [mg51899] Re: [mg51841] Re: Hypergeometric functions and Sum error in 5.01?
  • From: DrBob <drbob at>
  • Date: Thu, 4 Nov 2004 01:50:59 -0500 (EST)
  • References: <clssqp$3km$> <>
  • Reply-to: drbob at
  • Sender: owner-wri-mathgroup at

First you say there's nothing wrong, but:

1) be careful not to evaluate s2 "before n and m have been completely specified!"
2) embedding Sum in Table fails in unpredictable fashion, and
3) with ReplaceAll, "Mathematica tries to generate intermediate results and can be derailed".

Are you sure that's really the same thing as "nothing wrong"?


On Wed, 3 Nov 2004 01:25:17 -0500 (EST), Peter Valko <p-valko at> wrote:

> Richard,
> I think there is nothing wrong here, except that Mathematica seduces
> people to use a bit more complicated syntax then absolutely necessary.
> If I define the following two functions:
> s1[n_, m_] = Gamma[1+n] Hypergeometric2F1[1,m-n,-n,2]/(Gamma[1+m]
> Gamma[1-m+n])
> s2[n_, m_] := Total[Table[Binomial[n - i, m]2^i, {i, 0, n - m}]]
> then both s1[3,1]  and s2[3,1] give the same result that is 11.
> Note that for s2 I use delayed definition, because I do not want
> Mathematica to do anything before n and m have been completely
> specified!
> In your original post Sum was embedded in Table. I would not recommend
> that, because Sum is sometimes a simple programming construct doing
> summation as it is done in a procedural language, but Sum is also a
> function that does a lot of symbolic things, and you just do not know
> what is happening especially if you combine them with Replace.
>However, I think the real killer in your original post was how you
> evaluated your s1.
> If you use first one substitution for n, then another for m,
> Mathematica tries to generate intermediate results and can be derailed
> (see ComplexInfinity). However, if you simply evalute
> Gamma[1 + n]Hypergeometric2F1[1, m - n, -n, 2]/(Gamma[1 + m] Gamma[
>         1 - m + n]) /. {n -> 3, m -> 1}
> with simultanious substitution of n and m, then you get the right
> answer.
> I hope this helps.
> Peter
> "Richard Ollerton" <R.Ollerton at> wrote in message news:<clssqp$3km$1 at>...
>> Mathematica 5.01 produces the following:
>> In[1]:= s1=Sum[Binomial[n-i,m]2^i,{i,0,n-m}]
>> Out[1]= Gamma[1+n] Hypergeometric2F1[1,m-n,-n,2] / (Gamma[1+m] Gamma[1-m+n])
>> In[2]:= Table[{s1,Sum[Binomial[n-i,m]2^i,{i,0,n-m}]}/.n®3,{m,1,3}]
>> Out[2]= {{-5,11},{-11,5},{-15,1}}
>> Out[2] compares Mathematica's closed form with actual values.  There appears to be an error in the rules used by Sum when simplifying this expression.
>> Richard Ollerton
>> r.ollerton at

DrBob at

  • Prev by Date: Re: Re: Re: closing notebook cells
  • Next by Date: Re: Zero divided by a number...
  • Previous by thread: Re: Hypergeometric functions and Sum error in 5.01?
  • Next by thread: Re: bimodal distribution in sign of difference of Pi digits]