Re: A question about $Assumptions
- To: mathgroup at smc.vnet.net
- Subject: [mg68958] Re: A question about $Assumptions
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 25 Aug 2006 05:35:20 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <echdmb$oji$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Led wrote:
> [...]
> 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.
> [...]
> Shouldn't it be used that way?
No. Rather than modifying directly a system value, it is always better
and safer to use one of the following constructs:
Block[ { $Assumptions= { m,n}\[Element]Integers},
Integrate[ Cos[ m*x]* Cos[ n*x], { x,0,Pi}]]
Integrate[Cos[m*x]*Cos[n*x], {x, 0, Pi}, Assumptions -> {m, n}
\[Element] Integers]
Assuming[{m, n} \[Element] Integers, Integrate[Cos[m*x]*Cos[n*x], {x, 0,
Pi}]]
Regards,
Jean-Marc