       Re: A Problem with Simplify

• To: mathgroup at smc.vnet.net
• Subject: [mg87483] Re: A Problem with Simplify
• From: "David W.Cantrell" <DWCantrell at sigmaxi.net>
• Date: Fri, 11 Apr 2008 01:47:28 -0400 (EDT)
• References: <ftkb7f\$a9m\$1@smc.vnet.net>

```"Kevin J. McCann" <Kevin.McCann at umbc.edu> wrote:
> I have the following rather simple integral of two sines, which should
> evaluate to zero if m is not equal to n and to L/2 if they are the same.

That's right, assuming also that m and n are integers.

> The following is just fine
>
> Imn = Simplify[Integrate[Sin[(m*Pi*x)/L]*Sin[(n*Pi*x)/L], {x, 0, L}]]

Is it really "just fine"? The result of Integrate (on which Simplify has no
effect here) is

(L*n*Cos[n*Pi]*Sin[m*Pi] - L*m*Cos[m*Pi]*Sin[n*Pi])/(m^2*Pi - n^2*Pi)

That result is indeed fine if m and n are different, but it is
Indeterminate, which is surely not what you want, when m and n are equal.

> However, if I specify that m and n are integers, I only get the
> "general" solution of zero, i.e. when m and n are not equal.
>
> Imn = Simplify[Integrate[Sin[(m*Pi*x)/L]*Sin[(n*Pi*x)/L], {x, 0, L}],
>       Element[m, Integers] && Element[n, Integers]]
>
> The workaround is obvious in this case, but shouldn't Mathematica give multiple
> Integrate?

The reason that the above gave simply 0 is that, for integer m and n, the
numerator is 0 and

In:= 0/x

Out= 0

_irrespective_ of x (which, for all we know, might be 0).
Note that getting 0 for Out did not even require an invocation of
Simplify.

But I do have a "solution" for your "problem", assuming that you're using
version 6, which introduced the function Sinc. Let's consider an indefinite
integral:

An antiderivative of Sin[p x] Sin[q x] wrt x is

x/2 (Sinc[(p - q) x] - Sinc[(p + q) x])

_regardless_ of whether p and q are different or the same.

Of course, it's easy then to use that antiderivative to evaluate your
definite integral. It's

L/2 (Sinc[(m - n) Pi] - Sinc[(m + n) Pi])

which is valid regardless of whether m and n are integer or whether they
are equal or not.

If you're interested in reading more about how Sinc can be used in such
cases and in other applications, see my article "-- Sinc relatives, with
applications" at