# Make Mathematica evaluate an integral symbolically

The following integral has a symbolic solution, which MMA does not return.

$$\kappa(x) \begin{cases} \text{mod}(x,1)\le0.5: & 1\\ \text{mod}(x,1)>0.5: & 0 \end{cases}$$

$$f(z)=\int_0^1 \kappa(x+z)\kappa(x) \text{d} x$$

$$\kappa$$ is a periodic indicator function, the integral gives the two-point correlation function. It can be expressed as

$$f(z)=(0.5 - z) \kappa(z) - (0.5 - z) (1 - \kappa(z))$$.

The output to

ID[x_] = Boole[Mod[x, 1] < 0.5]
Integrate[ID[z + x] ID[x], {x, 0, 1}]


is just the unevaluated input integral. How can I add the integration rules such that I get the desired output? (Using Piecewise does not work)

# Edit 1

The above example works only for the value 0.5 and 0<z<1. Changing the 0.5 everywhere breaks the solution. But using Assumptions solve the problem:

ID[x_] = UnitStep[-Mod[x,1] + 1/3]
Integrate[ID[z + x] ID[x], {x, 0, 1}, Assumptions -> {0 < z < 1}]


Gives

Piecewise[{{(1/3)*(1 - 3*z), 0 < z < 1/3}, {(1/3)*(-2 + 3*z), 2/3 < z < 1}}, 0]


which is what I need.

# Edit 2

Without restricting $$0, the solution is obtained by replacing z->Mod[z] after integrating with assumptions. One could try to implement this integration rule.

ID[x_] = UnitStep[-Mod[x, 1] + 1/2];
Integrate[ID[z+x]ID[x],{x,0,1},Assumptions->{0<z<1}]/.{z->Mod[z,1]}
Plot[{ID[z],%}, {z,-1,2}]


• $z$ is a real number? – J. M. will be back soon Mar 5 at 10:19
• yes, everything is real – Rainer Glüge Mar 5 at 10:21
• Using UnitStep instead of Boole you can evaluate the indefinite integral. – b.gates.you.know.what Mar 5 at 10:29
• The analytic solution isn't correct I think. – Ulrich Neumann Mar 5 at 10:33
• <s>Yes, with the Assumption it works!</s> – Rainer Glüge Mar 5 at 10:51