Re: A limit bug

*To*: mathgroup at smc.vnet.net*Subject*: [mg84525] Re: A limit bug*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Wed, 2 Jan 2008 01:18:26 -0500 (EST)*References*: <20080101110626.081$mK_-_@newsreader.com>

On 2 Jan 2008, at 01:06, David W. Cantrell wrote: > [Message also posted to: comp.soft-sys.math.mathematica] > > Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote: >> On 1 Jan 2008, at 11:16, David W.Cantrell wrote: >> >>> A recent question in sci.math led to something which should also >>> interest this group. >>> >>> The OP asked about the limit of (p + q)!/(p! q!) as both p and q >>> increase without bound. And he said later >>> >>>> I wasn't sure about it because Mathematica gives me a limit of >>>> zero. >>>> Isn't that strange? >>> >>> I responded as follows. >>> >>> ---------------------------------------------- >>> >>> Well, it's a bug. I suppose that what you did in Mathematica was >>> something like >>> >>> In[3]:= Limit[Limit[(p + q)!/(p! q!), q -> Infinity], p -> Infinity] >>> >>> Out[3]= 0 >>> >>> But note that there is not any way -- well, at least none known to >>> me -- in Mathematica to get a true general "two-variable" limit: >>> >>> limit f(x,y) as (x,y) -> (x0,y0) >>> >>> However, Mathematica can get a correct answer for your limit >>> problem. >>> >>> First, realize that (p + q)!/(p! q!) is Multinomial[p, q]. So you >>> might try >>> >>> In[5]:= Limit[Limit[Multinomial[p, q], q -> Infinity], p -> >>> Infinity] >>> >>> Out[5]= Limit[Limit[Multinomial[p, q], q -> Infinity], p -> >>> Infinity] >>> >>> Since that remains unevaluated (but at least there was now no bug!), >>> you might consider the possibility that it remained unevaluated for >>> a good reason, namely, because a little more information had to be >>> provided: >>> >>> In[6]:= Limit[Limit[Multinomial[p, q], q -> Infinity, >>> Assumptions -> p > 1], p -> Infinity] >>> >>> Out[6]= Infinity >>> >>> Success! Happy New Year! >>> >>> But BTW, note that, curiously, the following fails: >>> >>> In[7]:= Limit[Limit[(p + q)!/(p! q!), q -> Infinity, >>> Assumptions -> p > 1], p -> Infinity] >>> >>> Out[7]= Indeterminate >>> >>> David >>> >> >> I think using iterated limits above actually obscures what happens. >> In >> fact: >> >> Limit[Multinomial[p, q], q -> Infinity, >> Assumptions -> p > 1] >> Infinity >> >> Thus there is not much point in further taking limits as p->Infinity, >> since the answer, being independent of p will certainly not change. >> On >> the other hand >> >> Limit[(p + q)!/(p!*q!), q -> Infinity, Assumptions -> p > 1] >> Infinity/p! >> >> We can now see what happened here and the source of the problem. > > I think you lost sight of the main problem, the thing I called a bug, > namely, Out[3] = 0. As best I can tell, we don't know the source of > that > problem. > > But yes, what you say probably does help to see why Out[7] was > Indeterminate. > >> Mathematica simply computed >> Limit[(p + q)!/q!, q -> Infinity, Assumptions -> p > 1] >> Infinity >> >> and then divided the answer by p! returning Infinity/p! since >> Mathematica leaves Infinity/a unevaluated for an undefined symbol a. > > But Mathematica can correctly simplify Infinity/a if we give it > appropriate > information about a. More about that below. > >> Now, of course taking the limit with respect to p as p->Infinity will >> quite correctly produce Indeterminate. > > No, that's not correct. The limit of Infinity/p! as p increases > without > bound is determinate. It's simply Infinity. > > Perhaps you were thinking of Infinity/Infinity!, but the fact that > that is > Indeterminate is irrelevant. (Remember: ...in a _deleted_ > neighborhood...) > > BTW, here's something that does work correctly (without using > Multinomial): > > In[13]:= Limit[Assuming[p > 1, FullSimplify[Limit[(p + q)!/(p! q!), > q -> Infinity]]], p -> Infinity] > > Out[13]= Infinity > > Note that FullSimplify, rather than just Simplify, must be used. > >> I would not call this a bug but rather a bit of a design problem. > > FWIW, I hadn't called Out[7] a bug before either. In any event, giving > Indeterminate for a limit which should actually be Infinity is not as > serious a problem as giving 0. > >> On a related note; although I think Mathematica is right to leave >> unevaluated expressions such as Infinity/a, I would prefer it to >> return Infinity in the example below: >> >> Assuming[Element[a, Reals] && a != 0, >> Simplify[Infinity/a]] > > I can understand why you'd want that behavior. > Mathematica does a good job with both > > In[15]:= Assuming[a > 0, Simplify[Infinity/a]] > > Out[15]= Infinity > > and > > In[16]:= Assuming[a < 0, Simplify[Infinity/a]] > > Out[16]= -Infinity > > David W. Cantrell Touche ;-) I forgot all about DirectedInfinity etc... I guess I should have gone easier on the New Year night drinking . Andrzej Kozlowski