0
$\begingroup$

I'm defining functions

    e[k_, t_] := Cos[Pi (k - 1) t]
    cosIntRaw[k_, l_, m_] := Integrate[e[k, t] e[l, t] e[m, t], {t, 0, 1}]
    cosInt[k_, l_, m_] := 
       Assuming[Element[{k, l, m}, Integers], Refine[cosIntRaw[k, l, m]]]

The value that Mathematica gives me for cosInt[k,l,m] is 0.

But explicitly evaluating cosInt[1, 1, 1], I get 1. In fact, for any given value of m, the number of nonzero elements in the n$\times$n matrix whose [k,l] element is cosInt[k,l,m] grows linearly in n, said matrix having a nice banded structure.

Any idea why Mathematica gives me 0 for cosInt[k,l,m]?

Thank you!

$\endgroup$
1
  • $\begingroup$ I think this is covered in posts at the links 1, 2, 3, 4, and probably several others. Given that a couple of these are from MSE, I'm going to vote to close as a duplicate. $\endgroup$ Commented Jun 26, 2014 at 17:45

1 Answer 1

1
$\begingroup$
e[k_, t_] := Cos[Pi (k - 1) t];

cosIntRaw[k_, l_, m_] :=
  Integrate[e[k, t] e[l, t] e[m, t], {t, 0, 1}];

cosIntRaw[k, l, m] // Simplify

-((Sin[(k - l - m)*Pi]/ (1 + k - l - m) + Sin[(k + l - m)*Pi]/ (-1 + k + l - m) + Sin[(k - l + m)*Pi]/ (-1 + k - l + m) + Sin[(k + l + m)*Pi]/ (-3 + k + l + m))/(4*Pi))

The Sin functions are all zero at integer multiples of Pi, i.e., for {k, l, m} all integers.

cosInt[k_, l_, m_] = 
 Assuming[Element[{k, l, m}, Integers], Simplify[cosIntRaw[k, l, m]]]

0

cosIntRaw[1,1,1] is indeterminate (division by zero); however, the limits exist.

Limit[cosIntRaw @@ #, a -> 1] & /@ Permutations[{a, 1, 1}]

{1, 1, 1}

Limit[cosIntRaw @@ #, a -> 1] & /@ Permutations[{a, a, 1}]

{1, 1, 1}

Limit[cosIntRaw[a, a, a], a -> 1]

1

These limits are essentially taken when the value substitutions are made prior to integration

Integrate[e[1, t] e[1, t] e[1, t], {t, 0, 1}]

1

Alternatively, rewrite cosIntRaw in terms of Sinc functions to handle the limits

cosIntRaw[k_, l_, m_] = (cosIntRaw[k, l, m] /. Sin[x_] :> x*Sinc[x]) // 
  Simplify

1/4 (Sinc[(1 + k - l - m) [Pi]] + Sinc[(-1 + k + l - m) [Pi]] + Sinc[(-1 + k - l + m) [Pi]] + Sinc[(-3 + k + l + m) [Pi]])

cosIntRaw[1, 1, 1]

1

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.