MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: case differentiation problem with "Assumptions"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83679] Re: [mg83652] case differentiation problem with "Assumptions"
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Wed, 28 Nov 2007 05:31:14 -0500 (EST)
  • References: <200711271114.GAA15885@smc.vnet.net>

Paul.Wenk at googlemail.com wrote:
> Hello,
> 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?
> 
> cheers,
> Paul
> 
> p.s.
> I'm using Mathematica 6.0.0 on Linux x86

This comes up from time to time. The underlying issue is that 
simplifications involving integrality specifications can and will give 
results that are "generic", that is, possibly incorrect on a finite set. 
Let's do the computation without the integrality assumption, then 
post-simplify.

In[17]:= InputForm[ii = Integrate[Cos[(n*Pi*(-W + y))/(2*W)]^2/W,
          {y,-W,W}, Assumptions->{W>0,n>0}]]
Out[17]//InputForm= 1 + (Cos[n*Pi]*Sin[n*Pi])/(n*Pi)

In[18]:= Simplify[ii, Assumptions->Element[n,Integers]]
Out[18]= 1

But as observed, the proper value at the origin is actually 2.

In[19]:= Limit[ii, n->0]
Out[19]= 2

The moral, such as it is, is that one should avoid such assumptions 
inside Integrate (which will discard them anyway, except for final 
post-processing). One should moreover apply them with caution after the 
fact.


Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: Mathematica 6.0 Desperation
  • Next by Date: Re: Mathematica 6.0 Desperation
  • Previous by thread: case differentiation problem with "Assumptions"
  • Next by thread: Re: case differentiation problem with "Assumptions"