Re: [Mathematica 6] Integrate strange result
- To: mathgroup at smc.vnet.net
- Subject: [mg78366] Re: [Mathematica 6] Integrate strange result
- From: dimitris <dimmechan at yahoo.com>
- Date: Fri, 29 Jun 2007 05:46:11 -0400 (EDT)
- References: <f5vs8m$kob$1@smc.vnet.net>
Nasser Abbasi : > In[13]:= $Version > Out[13]= 6.0 for Microsoft Windows (32-bit) (April 27, 2007) > > The problem is this: When I ask Mathematica to integrate something > involving some constant parameter, it gives an answer for some range > of the constant involved, say range A, and it says there is no answer > for the other range, say range B > > But next, when I specify, using assumptions, that the constant is now > in range B, then Mathematica does given an answer to the integral ! > > Why does it in one case say there is no answer if the constant is in > range B, and in the second case it gives an answer when the constant > is in range B? > > case 1 > ======== > > In[2]:= f = (1 + k*Sin[a]^2)^(1/2); > In[12]:= Assuming[Element[k, Reals], Integrate[f, {a, 0, 2*Pi}]] > > Out[12]= If[k >= -1, 4*EllipticE[-k], Integrate[Sqrt[1 + > k*Sin[a]^2], {a, 0, 2*Pi}, Assumptions -> k < -1]] > > notice in the above, it says for k<-1 there is NO answer > > case 2 > ======= > In[2]:= f = (1 + k*Sin[a]^2)^(1/2); > In[10]:= Assuming[Element[k, Reals] && k < -1, Integrate[f, {a, 0, > 2*Pi}]] > > Out[10]= 0 > > Notice in the above, for k<-1 it gives an answer, which is zero. > > What is it I am missing here? > > thanks > Nasser When Assumptions return a of the form structure If[o==True,o1,Integrate[...]] it does not mean necessarily that if o!=True then the integral cannot be evaluated. Consider for example the following integral Integrate[E^(-x^2 - x*y)/Sqrt[x], {x, 0, Infinity}] We have In[12]:= Integrate[E^(-x^2 - x*y)/Sqrt[x], {x, 0, Infinity}] Out[12]= If[Re[y] < 0, (E^(y^2/8)*Pi*Sqrt[-y]*(BesselI[-(1/4), y^2/8] + BesselI[1/4, y^2/8]))/(2*Sqrt[2]), Integrate[1/(E^(x*(x + y))*Sqrt[x]), {x, 0, Infinity}, Assumptions - > Re[y] >= 0]] That is for Re[y]<0 the integral is (E^(y^2/8)*Pi*Sqrt[-y]*(BesselI[- (1/4), y^2/8] + BesselI[1/4, y^2/8]))/(2*Sqrt[2]); a check can confirm its validity. How about Re[y]>0? Is it divergent? There is not a closed form expression? Try it out! In[14]:= ({#1, Integrate[E^(-x^2 - x*y)/Sqrt[x], {x, 0, Infinity}, Assumptions - > #1[Re[y], 0]]} & ) /@ {Less, Greater} Out[14]= {{Less, (E^(y^2/8)*Pi*Sqrt[-y]*(BesselI[-(1/4), y^2/8] + BesselI[1/4, y^2/8]))/(2*Sqrt[2])}, {Greater, (1/2)*E^(y^2/8)*Sqrt[y]*BesselK[1/4, y^2/8]}} That is, we get a different form of answer. For y=0? In[26]:= With[{y = 0}, Integrate[E^(-x^2 - x*y)/Sqrt[x], {x, 0, Infinity}]] FullSimplify[% == (1/2)*Gamma[1/4]] Out[26]= 2*Gamma[5/4] Out[27]= True Note also, In[32]:= {Limit[(E^(y^2/8)*Pi*Sqrt[-y]*(BesselI[-(1/4), y^2/8] + BesselI[1/4, y^2/8]))/(2*Sqrt[2]), y -> 0, Direction -> 1], Limit[(1/2)*E^(y^2/8)*Sqrt[y]*BesselK[1/4, y^2/8], y -> 0, Direction -> -1]} (Plus[#1 - #1] & ) @@ % Out[32]= {Pi/(Sqrt[2]*Gamma[3/4]), (1/2)*Gamma[1/4]} Out[33]= 0 That is the integral is a continuous function with respect to the parameter y. In[38]:= Plot[NIntegrate[Exp[-x^2 - x*y]/Sqrt[x], {x, 0, Infinity}], {y, -2, 2}] Dimitris