Re: Limit question

*To*: mathgroup at smc.vnet.net*Subject*: [mg31523] Re: Limit question*From*: "Alan Mason" <swt at austin.rr.com>*Date*: Thu, 8 Nov 2001 04:57:38 -0500 (EST)*References*: <9sb2du$p56$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hello, It's odd that Limit should have this hole in it-- after all, Limit[x^2/Exp[x], x->Infinity] = 0 is done correctly. The notebook below gives a quick and dirty routine that implements de l'Hopital's rule. It works correctly in the cases considered (including your first example) and can serve as a start. Of course, it will bomb if taking successive derivatives doesn't solve the problem (i.e., when de l'Hopital's rule is of no use). There's actually a lot one could say about the reasons for the choices in this little program. In particular, why it's necessary to input a list {num_, den_} representing num/den, and not just num_/den_, to LimitHosp. To see why num_/den_ doesn't work, notice that it won't match Exp[x]/x^2 although it does match Exp[x]/x. To see why, look at FullForm[Exp[x]/x^2] = Times[Power[E, x], Power[x, -2]]; this doesn't match a/b, FullForm[a/b] = Times[a, Power[b, -1]], because of the -2. The primary arithmetic heads in Mathematica are Plus and Times; Minus and Divide don't exist as such but are represented as Times[-1, u_] and Power[u_, -1], resp. For pattern matching one is therefore led to try num_ den_ and assign f1=num, g1 = 1/den. But now another problem arises: Times is Orderless and Mathematica puts its arguments in canonical order; so you can't be sure which argument is num and which is den. Example: In[8]:= ff = FullForm; ff[Sin[x]^2/x^2] Out[9]//FullForm= Times[Power[x,-2],Power[Sin[x],2]] The factors have been switched around. There's also ambiguity -- the fraction a/(b c) can be regarded as having numerator a/b and denominator c and this choice can be important, as in the {Exp[x^2]/ Exp[x] ,x^3} example below, where {Exp[x^2], Exp[x] x^3} won't work . To avoid all these problems I pass a list, even though it seems less natural. For your second example, Limit[Exp[x]/Gamma[1+x], x->Infinity]=0, you'll need to use Sterling's formula. Limit is one of the weakest built-in functions of Mathematica and it needs a lot of work for the special functions. It can't do Limit[BesselJ[1, x]/Sqrt[x], x->Infinity] either, for example, although the answer is well known to be 0. Oddly, direct substitution BesselJ[1, x]/Sqrt[x] /. x -> Infinity does give 0. Looks like Limit is some kind of neglected poor relation. (*************************** for brevity I've deleted the output from the Print statements **********) In[62]:= LimitHosp[{num_, den_}, x -> a_, val_:Infinity] := Module[{f1 = num, g1 = den, L}, While[Limit[f1, x -> a] == val && Limit[g1, x -> a] == val , Print["f1, g1 are ", f1, ", ", g1]; If[NumberQ[L = Limit[f1/g1, x -> a]], Return[L]]; f1 = D[f1, x]; g1 = D[g1, x] ]; Limit[f1/g1, x -> a] ] lh := LimitHosp; In[63]:= lh[{Exp[x],x^2}, x\[Rule]Infinity] Out[63]= \[Infinity] In[66]:= lh[{Exp[x^2]/ Exp[x] ,x^3}, x\[Rule]Infinity] (* NOTE: {Exp[x^2], Exp[x] x^3} will bomb *) Out[66]= \[Infinity] In[69]:= lh[{x^12 , Exp[x/100]}, x\[Rule]Infinity] Out[69]= 0 In[13]:= lh[{Sin[x]^3, x (1-Cos[x])}, x\[Rule]0, 0] Out[13]= 2 Alan (**************************************************************************) "Leonard Howell" <lwhowell at knology.net> wrote in message news:9sb2du$p56$1 at smc.vnet.net... > I'm trying to evaluate Limit [Exp[x] * (1/x^2), x-> Infinity] with > Mathematica but can not seem to get the correct answer of Infinity. Next, I > want Limit [Exp[x] /( x!), x-> Infinity] but can't get it either. Can > someone please provide guidance? > > Thanks, Leonard >

**Follow-Ups**:**Re: Re: Limit question***From:*Daniel Lichtblau <danl@wolfram.com>