How to extend a function by period and display it
Here is a somewhat more general approach. It allows the basic period of the periodic extension to be any interval in its source function's domain.
Clear[f, xf]
f[x_] := -((E^x + E^(-x))/2)
f[x_, lo_, hi_] /; lo ≤ x < hi := f[x]
xf[x_, lo_, hi_] :=
With[{span = hi - lo},
Piecewise[{
{f[x + span Quotient[hi - x, span], lo, hi], x < lo},
{f[-x + span Quotient[x - lo, span], -hi, -lo], x > hi}},
f[x, lo, hi]]]
The plot you request is then:
Plot[xf[x, -1, 1], {x, -5, 5}, AxesOrigin -> {0, -1.54}]
But a plot making the period of xf
the asymmetric interval {-1, .5]
is just as easy.
Plot[xf[x, -1, .5], {x, -4, 5}, AxesOrigin -> {0, -1.54}]
One possible way
T = 2; (*period*)
f[x_] := -((E^x + E^(-x))/2);
fExtended[x_] := Piecewise[{{f[x], -T/2 < x < T/2},
{fExtended[x - T], x > T/2},
{fExtended[x + T], x < T/2}}];
Plot[fExtended[x], {x, -1, 1}, AxesOrigin -> {0, 0}, AxesOrigin -> {0, 0}]
Plot[fExtended[x], {x, -2 T, 2 T}, AxesOrigin -> {0, 0}, AxesOrigin -> {0, 0}]
Let's replace x with Mod[x, 2, -1]
Plot[-((E^Mod[x, 2, -1] + E^(-Mod[x, 2, -1]))/2), {x, 0, 10}]
We can get the result we want.