Ohh yes I skipped the x from your formula.

If you write ```float_X x=position_x- 0.5*L_x``` than your comment is wrong.

If I strict implement the formula from your comment than it ist:
```C++
float_X x=position_x- L_x;
float_X L_X_half=L_x/float_X(2.0);
return float_X(math::abs(x)<=L_x_half)*(float_X(1.0)-float_X(2.0) * x/ L_x_half );
```