Group Abstract Group Abstract

Message Boards Message Boards

0
|
546 Views
|
9 Replies
|
6 Total Likes
View groups...
Share
Share this post:
GROUPS:

Plotting/evaluating a function defined from a peicewise recurrence relation

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: $$\small{ s_{t+1}(x)=\begin{cases} q_{t/2} & x\in\bigcup_{j\in\{1,\cdots,t\}}(q_j-1/k_t,q_j+1/k_t), \, t \text{ is even}\\ k_t^2 & x \in\bigcup_{j\in\{1,\cdots,t\}}(q_j-1/k_t,q_j+1/k_t), \, t \text{ is odd}\\ s_t(x) & \text{otherwise} \end{cases}}$$ 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?

POSTED BY: Bharath Krishnan
9 Replies

I tried

In[328]:= Table[s[n, 1/2], {n, 1, 20, 2}]

Out[328]= {0, 0, 1, -1, 1/2, -(1/2), 2, -2, 1/3, -(1/3)}

and it made me doubt that the limit necessarily exists at rational points.

POSTED BY: Gianluca Gorni

He said for the bad points you should set the function to equal zero.

POSTED BY: Bharath Krishnan

The Phd student didn't clarify, but I think in the definition of $s_{t+1}$, $x\in(q_j-1/k_t,q_j+1/k_t),\, j=1,\cdots,t$ is supposed to be $x\in\bigcup_{j\in\{1,\cdots,t\}}(q_j-1/k_t,q_j+1/k_t)$. Are they equivelant?

POSTED BY: Gianluca Gorni

Here is my attempt:

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]]];
enumerateRationals[0] = {};
s[0, _] = 0;
s[t_Integer, x_] := s[t, x] =
  Piecewise[{
    {q[(t - 1)/2], 
     EvenQ[t - 1] && 
      0 <= Min[Abs[x - enumerateRationals[t - 1]]] < 1/k[t - 1]},
    {k[t - 1]^2, 
     OddQ[t - 1] && 
      0 <= Min[Abs[x - enumerateRationals[t - 1]]] < 1/k[t - 1]}},
   s[t - 1, x]]
POSTED BY: Gianluca Gorni
POSTED BY: Bharath Krishnan

If you define a function this way:

s[t_ + 1] := 

the pattern will be matched only if the argument is of the form something+1. With s[3] it will not match, because the evaluator does not take the initiative of rewriting 3 as 2+1. You should define this way:

 s[t_] := 

For example, the factorial can be defined this way:

fac[0] = 1;
fac[n_] := fac[n] = n*fac[n - 1];

but not this:

fac[0] = 1;
fac[n_ + 1] := fac[n + 1] = (n + 1)*fac[n];
POSTED BY: Gianluca Gorni

Thank you, but even if we can define s[t], we need a way to compute s[t] as t->Infinity (i.e., to give the function $\mathcal{G}:\mathbb{R}\to\mathbb{R}$) and evalute $\mathcal{G}(x)$ at any $x$-value.

Can you give a code which does this?

POSTED BY: Bharath Krishnan

After this calculation

In[328]:= Table[s[n, 1/2], {n, 1, 20, 2}]

Out[328]= {0, 0, 1, -1, 1/2, -(1/2), 2, -2, 1/3, -(1/3)}

I have some doubts that the limit exists for all x.

POSTED BY: Gianluca Gorni

Sorry, for bothering you. According to the PhD student, the function doesn't converge for a measure zero set. In this case, set $\mathcal{G}=0$.

POSTED BY: Bharath Krishnan
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard