       Re: how to explain this weird effect? Integrate

• To: mathgroup at smc.vnet.net
• Subject: [mg46275] Re: how to explain this weird effect? Integrate
• Date: Thu, 12 Feb 2004 22:47:18 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```On 2/12/04 at 7:16 AM, nma124 at hotmail.com (steve_H) wrote:

>r = Integrate[Sin[m  x] Sin[n x], {x, 0, 2 Pi}]

>then I type

>r /. {n -> 2, m -> 2}

>I get error (1/0 expression encountered) and no result.

When I do the Integral in Mathematica 5.0 I get a result with a denominator of m^2 - n^2. So, of course substituting the same value for both m and n causes this denominator to be 0 and Mathematica complains.

>but when I let m=2 and n=2 right into the integral first, it works:

Yes, when m=n Mathematica can see you are Integrating Sin[m x]^2 which gives a result of

Pi - Sin[4 n Pi]/(4 n). So, there is no division by zero no matter what positive integer is selected for n.

<snip>

>But it seems to me I should get the same result if I replace m,n
>inside the integral before the integration operation starts, or
>replace them afterwords.

While I can understand while you expect this, looking at the results of the integral before you replace m and n clearly shows the problem. Undoubtedly, there is a way to eliminate the m^2 - n^2 term from the demonimator and show the first integral is the same as the second integral when m = n. But it isn't reasonable to expect simple replacement to do this.
--
To reply via email subtract one hundred and four

```

• Prev by Date: Re: FindRoot in Version 5
• Next by Date: Re: how to explain this weird effect? Integrate
• Previous by thread: Re: how to explain this weird effect? Integrate
• Next by thread: Re: how to explain this weird effect? Integrate