Piecewise function: when 1 <= x < 2, f[x] = 1 - Abs[2 x - 3]; when x >= 2, f[x] = 1/2 f[x/2].
I want to compute all the specific analytical expressions of the piecewise function in the interval 1 <= x < 8.
I used the following code to solve it:
f[x_] := Piecewise[{{1 - Abs[2 x - 3], 1 <= x < 2}, {g[x], x >= 2}}]
Reduce[{PiecewiseExpand[f[x] == 1/2 f[x/2], 8 > x >= 2]}, g[x]]
After running the code, the result obtained was: when x>=4, the analytical expression for f[x] was not solved.
(x < 3 && g[x] == -1 + x/2) || (3 <= x < 4 &&
g[x] == (4 - x)/2) || (x >= 4 && g[x] == 1/2 g[x/2])
Therefore, I manually added all the analytical expressions obtained for the interval 2≤x<4 from the previous code into the original code and ran it again, finally obtaining all the analytical expressions for the interval 1≤x<8.
f[x_] :=
Piecewise[{{1 - Abs[2 x - 3], 1 <= x < 2}, {-1 + x/2, 3 > x >= 2}, {(
4 - x)/2, 3 <= x < 4}, {g[x], x >= 4}}]
Reduce[{PiecewiseExpand[f[x] == 1/2 f[x/2], x >= 2]}, g[x]]
x < 3 ||
3 <= x <
4 || (4 <= x < 6 && g[x] == 1/8 (-4 + x)) || (6 <= x < 8 &&
g[x] == (8 - x)/8) || (x >= 8 && g[x] == 1/2 g[x/2])
The problem I'm facing is how to automatically generate all the explicit expressions over a given interval in a single run, avoiding manual code adjustments and repeated executions. This manual process is tedious.