# Assumptions not working with Trianglewave or Floor functions

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?

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

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  *)

• 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. Commented Nov 28, 2016 at 6:15