Re: case differentiation problem with "Assumptions"
- To: mathgroup at smc.vnet.net
- Subject: [mg83681] Re: case differentiation problem with "Assumptions"
- From: "David W.Cantrell" <DWCantrell at sigmaxi.net>
- Date: Wed, 28 Nov 2007 05:32:23 -0500 (EST)
- References: <figumr$fnp$1@smc.vnet.net>
Paul.Wenk at googlemail.com wrote: > I found the following problem using $Assumptions: > Let us calculate the integral: Integrate[Cos[(n \[Pi] (-W + y))/(2 > W)]^2/W,{y,-W,W}] > for n \[Element] Integers and n>0 you receive 1, for n=0 you receive 2. > If you make the assumption > $Assumptions = n \[Element] Integers > then you get for the above integral the output 1, although for n=0 > (also integer) it should be 2! > Why mathematica is not using a case differentiation in this case? How > is the information about the integer element inserted? > > p.s. > I'm using Mathematica 6.0.0 on Linux x86 I'm using version 5.2, but that may not make a difference. Your observation seems to be that In[7]:= Integrate[Cos[n Pi (-W + y)/(2 W)]^2/W, {y, -W, W}, Assumptions -> Element[n, Integers]] Out[7]= 1 despite the fact that, if n == 0, the correct result is 2 instead. Let's examine the source of this problem and a way in which this problem could perhaps be eliminated in version 6. Note that, without any assumption on n, we have In[8]:= Integrate[Cos[n Pi(-W + y)/(2 W)]^2/W, {y, -W, W}] Out[8]= 1 + Sin[2*n*Pi]/(2*n*Pi) That result is valid for nonzero n, integer or not. But it fails if we literally substitute 0 for n, giving Indeterminate. OTOH, if we take its limit as n approaches 0, we do get the desired result, 2 . Now, for In[8], there is a result which is _literally_ valid for all n: 1 + Sinc[2*n*Pi] I have mentioned in this newgroup and others several times that it would be useful to implement the sine cardinal function in computer algebra systems. One use is illustrated above. And I see that version 6 now does implement the sine cardinal function as Sinc. But perhaps, in version 6, In[8] still produces Out[8]. If so, that would hardly be surprising, since Sinc was such a recent addition. But I would hope that, eventually, Mathematica will take full advantage of having Sinc implemented and that then the result of In[8] would be 1 + Sinc[2*n*Pi]. Because it's probably related to why Out[7] was simply 1, also note that In[9]:= Assuming[Element[n, Integers], Simplify[Sin[2 n Pi]/(2 n Pi)]] Out[9]= 0 despite the fact that Sin[2 n Pi]/(2 n Pi) is literally Indeterminate if n == 0. And the above is probably related to In[10]:= 0/x Out[10]= 0 despite the fact that 0/x is literally Indeterminate if x == 0. David W. Cantrell