MathGroup Archive 2006

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

Search the Archive

Re: A question about $Assumptions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68967] Re: A question about $Assumptions
  • From: "David W. Cantrell" <DWCantrell at sigmaxi.net>
  • Date: Fri, 25 Aug 2006 05:35:31 -0400 (EDT)
  • References: <echdmb$oji$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Led" <zep.led at laposte.net> wrote:
> Mathematica 5.2 (Windows) gives:
>
> In[1]:= Integrate[ Cos[m*x] * Cos[n*x] ,{x,0,Pi}]
>
> Out[1]= (m*Cos[n*Pi]*Sin[m*Pi] - n*Cos[m*Pi]*Sin[n*Pi])/(m^2 - n^2)
>
> which is the expected result.

Expected, perhaps, but still not valid if we naively replace n and m by the
same value.

> But if instead one writes
>
> In[2]:= $Assumptions={{m,n}â??Integers};
> Integrate[ Cos[m*x] * Cos[n*x] ,{x,0,Pi}]
>
> Out[2]= 0
>
> the result is correct only if m~=n.

I suspect that many readers will be confused by the notation you used.
You're saying that the result is correct only if m is not equal to n. In
fact, the result also fails if m = -n. But this sort of "error" is hardly
surprising. It's not much different from

In[5]:= x/x
Out[5]= 1

where the result is not valid when x = 0.

> What's the problem with $Assumptions?

Nothing. If n and m are integers, the numerator of Out[1] is _always_ 0.

Let me take this opportunity to put in a good word for the sine cardinal
function:

sinc(x) = 1 if x = 0, sin(x)/x otherwise.

If that function is available, we can give an expression for
Integrate[Cos[m*x]*Cos[n*x], {x, 0, Pi}] which is always correct:

Pi/2 (sinc(Pi(m - n)) + sinc(Pi(m + n)))

At least in my opinion, that should be "the expected result", but sinc is
not implemented in Mathematica.

David


  • Prev by Date: Re: How to handle Arrays that has functional parameters:
  • Next by Date: Re: General--Difficulties in Understanding Mathematica Syntax
  • Previous by thread: Re: A question about $Assumptions
  • Next by thread: Graph inside another graph