5
$\begingroup$

The interval $[0,1]$ of the real line, which we call $C_0$, and divide it into three equal subintervals. In this way we obtain the following intervals $[0,1/3]$,$[1/3,2/3]$,$[2/3,1]$, and we get rid of the interval $[1/3,2/3]$. Then, we obtain the set $C_1=[0,1/3]\cup[2/3,1]$. Now repeat the above process on each of the intervals $C_1$, then $C_2=[0,1/9]\cup[2/9,3/9]\cup[6/9,7/9]\cup[8/9,1]$ Proceeding in the same way we obtain $C_3,C_4,C_5,C_6,\dots$ Thus we define the Cantor set as the intersection of all $C_i$ constructed before. Now the goal is to obtain the graph of the Cantor set in the different steps

$\endgroup$
7
$\begingroup$

You can also use new-in-version-10 NumberLinePlot. The last example in NumberLinePlot >> Applications slightly modified:

NumberLinePlot[NestList[# /. {a_, b_} :>
   Sequence[{a,2 a/3 + b/3}, { a/3 + 2 b/3, b}] &,
   Interval[{0, 1}], 5], {x, 0, 1},AspectRatio->1/4, 
 PlotStyle -> Directive[CapForm["Butt"],Thick]]/. Point[x_]:>Sequence[]

enter image description here

| improve this answer | |
$\endgroup$
6
$\begingroup$

It may be an available answer:

In=

n = 5;
f = #/3 &; g = #/3 + 2/3 &;
Fission[list_] := Flatten@Through[{f, g}@list]
intervals = NestList[Fission, {Interval[{0, 1}]}, n];
segments[n_] := 
 intervals[[n]] /. Interval[{a_, b_}] :> Line[{{a, 0.1 n}, {b, 0.1 n}}]
Graphics[{Black, Array[segments, n + 1]}]

Out=

enter image description here

| improve this answer | |
$\endgroup$
6
$\begingroup$

If you are in 11.1,CantorMesh will make your life easer:

NumberLinePlot[Interval @@@ (MeshPrimitives[#, 1] &@*CantorMesh /@ Range[4] /. 
    Line -> Flatten), PlotRange -> {0, 1}, AspectRatio -> 1, 
 PlotStyle -> Directive[PointSize[0], Black]]

Mathematica graphics

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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