Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: A question about $Assumptions

  • To: mathgroup at
  • Subject: [mg68965] Re: A question about $Assumptions
  • From: Roland Franzius <roland.franzius at>
  • Date: Fri, 25 Aug 2006 05:35:29 -0400 (EDT)
  • Organization: Universitaet Hannover
  • References: <echdmb$oji$>
  • Sender: owner-wri-mathgroup at

Led schrieb:
> Mathematica 5.2 (Windows) gives:
> In[1]:=
> Integrate[ Cos[m*x] * Cos[n*x] ,{x,0,Pi}]
> Out[1]=
> \!\(\(m\ Cos[n\ Ï?]\ Sin[m\ Ï?] - n\ Cos[m\ Ï?]\ Sin[n\ Ï?]\)\/\(m\^2 -
> n\^2\)\)
> which is the expected result. But if instead one writes
> In[1]:=
> $Assumptions={{m,n}â??Integers};
> Integrate[ Cos[m*x] * Cos[n*x] ,{x,0,Pi}]
> Out[1]=
> 0
> the result is correct only if m~=n.
> What's the problem with $Assumptions?
> Shouldn't it be used that way?

The problem is evaluation order. In the general formula setting n 
Integer generates zero before a check on m is performed. Calculate the 
diagonal and zero cases separately

Integrate[ Cos[n*x] * Cos[n*x] ,{x,0,Pi}]


Integrate[ Cos[0*x] * Cos[0*x] ,{x,0,Pi}]



Roland Franzius

  • Prev by Date: Re: Graph inside another graph
  • Next by Date: Re: How to handle Arrays that has functional parameters:
  • Previous by thread: Re: A question about $Assumptions
  • Next by thread: Re: A question about $Assumptions