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

*To*: mathgroup at smc.vnet.net*Subject*: [mg51899] Re: [mg51841] Re: Hypergeometric functions and Sum error in 5.01?*From*: DrBob <drbob at bigfoot.com>*Date*: Thu, 4 Nov 2004 01:50:59 -0500 (EST)*References*: <clssqp$3km$1@smc.vnet.net> <200411030625.BAA08368@smc.vnet.net>*Reply-to*: drbob at bigfoot.com*Sender*: owner-wri-mathgroup at wolfram.com

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"? Bobby On Wed, 3 Nov 2004 01:25:17 -0500 (EST), Peter Valko <p-valko at tamu.edu> 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 uws.edu.au> wrote in message news:<clssqp$3km$1 at smc.vnet.net>... >> 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 uws.edu.au > > > > -- DrBob at bigfoot.com www.eclecticdreams.net

**References**:**Re: Hypergeometric functions and Sum error in 5.01?***From:*p-valko@tamu.edu (Peter Valko)