2
$\begingroup$

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<z<1$, 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}]

Indicator function and two point correlation, both periodic

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.