Proper way to simplify integral result in Mathematica given integer constraints

后端 未结 4 1726
余生分开走
余生分开走 2021-02-19 14:59

Evaluating the following integral should be non-zero, and mathematica correctly gives a non-zero result

Integrate[ Cos[ (Pi * x)/2 ]^2 * Cos[ (3*Pi*x)/2 ]^2, {x,         


        
4条回答
  •  我在风中等你
    2021-02-19 15:38

    If you just drop the whole FullSimplify part, mathematica does the integration neatly for you.

    Integrate[
     Cos[(Pi x)/2]^2 Cos[((2 n + 1) Pi x)/2] Cos[((2 m + 1) Pi x)/
        2], {x, -1, 1}]
    

    enter image description here

    To include the condition that m and n are integers, it's better to use the Assumptions option in Integrate.

    Integrate[
     Cos[(Pi x)/2]^2 Cos[((2 n + 1) Pi x)/2] Cos[((2 m + 1) Pi x)/
        2], {x, -1, 1}, Assumptions -> Element[{m, n}, Integers]]
    

    enter image description here

提交回复
热议问题