1
$\begingroup$

How do we create a function which lists all points of the Cantor set? I want it to be listed as...

C[x_]:=.....

I don't know how to create a nested table which removes the middle thirds of the interval $[0,1]$, then $[1/9,2/9],[7/9,8/9]$ from $[0,1],...$. How do we do this? I am hoping we can include points that are not at the endpoints of the remaining interval such as $x=1/4,3/10$.

Edit: I tried using the answer from this post.

cantormesh[0] = {{0, 1}};
cantormesh[n_Integer?Positive] := 
 cantormesh[n] = 
  Join @@ ({{#[[1]], (2 #[[1]] + #[[2]])/3}, {(#[[1]] + 2 #[[2]])/
         3, #[[2]]}} & /@ cantormesh[n - 1])

But how do I make the cantor mesh number approach infinity so that I get all the listed points. How do I set up a function using variable n set equal to CantorMesh[n] which lists all these points.

$\endgroup$
8
  • 2
    $\begingroup$ Pretty sure the function in this answer solves your problem. $\endgroup$ Apr 23, 2020 at 15:16
  • $\begingroup$ @J.M. I am not sure how to extract the points. A quick answer would be appreciated. $\endgroup$
    – Arbuja
    Apr 23, 2020 at 16:31
  • $\begingroup$ @Arbuja Have you tried using the code in the linked answer? Have you tried running e.g. cantormesh[3]? You should explain how precisely the output of that function is not what you need? $\endgroup$
    – MarcoB
    Apr 23, 2020 at 17:35
  • $\begingroup$ @MarcoB I explained in my post. $\endgroup$
    – Arbuja
    Apr 23, 2020 at 18:57
  • 1
    $\begingroup$ "approach infinity so that I get all the listed points" - so if I understood you correctly, you want a list containing infinitely many points, that is infinitely long? $\endgroup$ Apr 24, 2020 at 0:28

1 Answer 1

1
$\begingroup$

If your question is about how to plot it, here is one way.

NumberLinePlot[Interval /@ cantormesh[2], Spacings -> 0]

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.