Edit: Cross-posted here.
Question: How do we evaluate the function \mathcal{G}:\mathbb{R}\to\mathbb{R} for any x\in\mathbb{R} and visualize the pointwise limit of s_{t+1}(x) as t\to\infty (see the definition below)?
(Definition of \mathcal{G}) Let (q_t)_{t\in\mathbb{N}} be a numbering of the rational numbers and k_t=2^{2^t}, and define functions s_t as follows:
If s_0=0 everywhere and:
each s_{t+1} agrees with s_t at all real numbers except a set of measure <1/2^t for big t, so one could consider \mathcal{G} the pointwise limit of the functions s_t, which is defined everywhere except measure 0 (in those bad points just define \mathcal{G}=0).
To answer the question, I tried the following code:
Edit: The code, seen below, is obviously flawed. See @GianlucaGorni’s response to this post for a definition of s_{t+1} for every t\in\mathbb{N}.
Clear["Global`*"]
enumerateRationals[n_Integer?Positive] :=
Module[{posRationals,
fullList},(*Generate enough positive rationals using the Calkin-
Wilf step*)
posRationals = NestList[1/(2 Floor[#] - # + 1) &, 1, Ceiling[n/2]];
(*Interleave:0,q1,-q1,q2,-q2...*)
fullList = Riffle[posRationals, -posRationals];
Prepend[fullList, 0][[1 ;; n]]]
r = 15;
enumerateRationals[r];
(*Generates the first r rational numbers in an enumeration*)
q[t_] := q[t] = enumerateRationals[t][[t]]
(*Takes the t-value in an enumeration*)
k[t_] := k[t] = 2^(2^t)
(*The function k[t] is important for the recurrence relation s[t]*)
s[0] == 0;
s[t_ + 1] :=
s[t + 1] =
Piecewise[{{q[t/2],
Union[Flatten[
Table[ImplicitRegion[
q[j] - 1/k[t] < x && x < q[j] + 1/k[t], {x}], {j, 1, t}]]] &&
EvenQ[t] == True}, {k[t]^2,
Union[Flatten[
Table[ImplicitRegion[
q[j] - 1/k[t] < x && x < q[j] + 1/k[t], {x}], {j, 1, t}]]] &&
OddQ[t] == True}}, s[t]]
s[3]
However, instead of getting a number function from s[3], I get the following output:
s[3]
Edit: I also need to extract an x-value from s[t] to get s[t,x], then I need to compute the pointwise limit of s[t,x] as t->Infinity to get \mathcal{G}(x) or bigG[x], and then finally need to visualize the pointwise limit.
Questions From The Attempt: How do we evaluate the pointwise limit s[t,x] in @GianlucaGorni’s response to this post, as t->Infinity, to get \mathcal{G}(x) or bigG[x] at the beginning of this post? Also, if possible, how do we visualize the pointwise limit of s[t,x] as t->Infinity?