f[-x] == -f[x]
means that the graph is point reflection respect to {0,0}
.
f[1-x]+f[1+x]==2
means that the graph is point reflection respect to {1,1}
since for two points {x1,y1}={1-x,f[1-x]}
and {x2,y2}={1+x,f[1+x]}
, (x1+x2)/2=((1-x)+(1+x))/2=1
and (y1+y2)/2=(f[1-x]+f[1+x])/2=1
.
I do not believe that Mathematica can do this automatic.Here we directly construct such expression by Mod
.( The idea is that we move or rotation 180 Degree
along direction {1,1}-{0,0}
).
Clear["Global`*"];
g[x_] := 2 x - x^2;
G[x_] :=
Piecewise[{{g[Mod[x, 2, 0]] + x - Mod[x, 2, 0],
0 <= Mod[x, 2, 0] <= 1}, {-g[-Mod[x, 2, -1]] + x -
Mod[x, 2, -1], -1 <= Mod[x, 2, -1] <= 0}}];
Plot[G[x], {x, -6, 6}, AspectRatio -> Automatic,
GridLines -> Automatic, Mesh -> {Range[-6, 6]},
MeshShading -> {Red, Cyan}]
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/aHXkn.png)
Try to do the more general cases
for two arbitrary point reflection.(Here we according to {x1, y1} = {2, 3};{x2, y2} = {5, 8};
instead of {x1,y1}={0,0};{x2,y2}={1,1};
Clear["Global`*"];
g[x_] := 2 x - x^2;
r[a_, b_][f_] := (2 b + #) &@*Minus@*f@*((2 a - #) &);
{x1, y1} = {2, 3};
{x2, y2} = {5, 8};
(*{x1,y1}={0,0};
{x2,y2}={1,1};*)
fun[x_, n_Integer] :=
Module[{maps},
maps = Which[n == 0, Identity, n > 0 && n ∈ Integers,
PadRight[{r[x2, y2], r[x1, y1]}, n, "Periodic"],
n < 0 && n ∈ Integers,
PadRight[{r[x1, y1], r[x2, y2]}, -n, "Periodic"]];
Apply[Composition][maps][g][x] // Simplify];
Show[Table[
Plot[fun[x, k] // Evaluate, {x, x1 + k (x2 - x1),
x2 + k (x2 - x1)}], {k, -5, 5}],
Graphics[{AbsolutePointSize[5], Red, Point@{x1, y1}, Purple,
Point@{x2, y2}}], PlotRange -> All]
Grid[Table[{x1 + k (x2 - x1) < x < x2 + k (x2 - x1),
fun[x, k]}, {k, -5, 5}], Frame -> All]
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/Hk41i.png)
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/PhURk.png)
Simplify
with user defined transformation rules should do that. This does not work however... $\endgroup$