MathGroup Archive 2012

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

Search the Archive

Re: Assuming and Integrate


f[m_, n_] = Assuming[Element[{n, m}, Integers],
  Piecewise[{
    {Integrate[Sin[n*x]*Sin[n*x], {x, 0, Pi}],
     m == n},
    {Integrate[Sin[n*x]*Sin[m*x], {x, 0, Pi}], m != n}}]]

Piecewise[{{Pi/2, m == n}}, 0]

f @@@ {{m, n}, {m, m}, {3, 2}, {3, 3}}

{Piecewise[{{Pi/2, m == n}}, 0],
   Pi/2, 0, Pi/2}

Assuming[m == n, Simplify[f[m, n]]]

Pi/2


Bob Hanlon


On Sat, Oct 6, 2012 at 1:53 AM,  <hamiltoncycle at gmail.com> wrote:
> When I try the line below in Mathematica 8 I get the answer 0 which is what I expect when m and n are different but not when m=n. Can anyone explain how to do this correctly?
>
> Assuming[Element[{n, m}, Integers], Integrate[Sin[n*x]*Sin[m*x], {x, 0, Pi}]]
>
> When m=n we should get Pi/2, as in this case:
>
> Assuming[Element[n, Integers], Integrate[Sin[n*x]*Sin[n*x], {x, 0, Pi}]]
>
> cheers, Robert
>



  • Prev by Date: Re: ordering a group of symbolic operators
  • Next by Date: Re: Clearing all variables and definitions: i.e. "resetting" mathematica
  • Previous by thread: Assuming and Integrate
  • Next by thread: Re: Assuming and Integrate