1
$\begingroup$

The assumption below:

Simplify[Integrate[Sin[2 n π x], {x, 0, 1}], Assumptions -> n ∈ Integers]

simplifies the integration and gives $0$ as the correct answer. However, for other functions like TriangleWave[x] or Floor[x], assumptions do not appear to work (Linux, Version 10.0).

None of the commands below simplifies:

Simplify[Integrate[TriangleWave[n x]^2, {x, 0, 1},   Assumptions -> n ∈ Integers]]
Simplify[Integrate[TriangleWave[n x]^2, {x, 0, 1}],  Assumptions -> n ∈ Integers]
Simplify[Integrate[Floor[x], {x, 0, n}],  Assumptions -> {n ∈ Integers, n > 0}]

I have to use command like:

Table[Integrate[TriangleWave[n x]^2, {x, 0, 1}], {n, 1, 5, 1}]

to generate a list of result, and "extract" the formula $f(n)$ by observation. Did I miss something?

$\endgroup$
1
  • $\begingroup$ @Moo I was answering a question on math.stackexchange.com where I use TriangleWave as sine function in Fourier series :-) $\endgroup$
    – Taozi
    Nov 28, 2016 at 5:23

1 Answer 1

2
$\begingroup$

Although it does not help in these particular cases, it is generally better to use Assuming as in Assuming[{assumptions}, Simplify[Integrate[ ... ]]] since the assumptions then will be used in both the Integrate and Simplify steps.

A workaround since Mathematica only solves the integrals for specific values of n is to generate a sequence for sequential values of n and then use FindSequenceFunction to find the closed-form expression for general n.

FindSequenceFunction[
 Table[
  Integrate[
   TriangleWave[n x]^2,
   {x, 0, 1}],
  {n, 10}],
 n]

(*  1/3  *)

FindSequenceFunction[
 Table[
  Integrate[
   Floor[x],
   {x, 0, n}],
  {n, 10}],
 n]

(*  1/2 (-1 + n) n  *)
$\endgroup$
1
  • $\begingroup$ I almost feel that the very existence of this function (which is new to me) is to handle the problem I had. Also thanks for clarifying the use of assumption. $\endgroup$
    – Taozi
    Nov 28, 2016 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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