Re: Cantor set

*To*: mathgroup at christensen.cybernetics.net*Subject*: [mg924] Re: Cantor set*From*: steve at tweedledee.ucsb.edu (Steve Trainoff)*Date*: Wed, 3 May 1995 00:03:09 -0400*Organization*: University of California, Santa Barbara

In article <3nkc8n$mq8 at news0.cybernetics.net> "Hamburger Dani" <dani at espresso.fh.huji.ac.il> writes: > The ternary Cantor set can be constructed iteratively from the interval [0,1] by > removing at the n+1'th step the middle third of each interval obtained in the > n'th step. > Can anyone come up with a nice MMa formula for calculating the beginning and > end points of the k'th interval (counted from lef t) in the n'th iteration? > > Thanks for any suggestions! > Sure, just write a recursive function to compute it. MMA is great for things like this. In[1]:= h[x_,0] = x; (* Recursive Anchor *) In[2]:= h[{a_,b_}, n_Integer] := {h[{a, a+(b-a)/3},n-1], h[{a+2(b-a)/3, b},n-1]} In[3]:= Partition[Flatten[h[{0,1},2]],2] 1 2 1 2 7 8 Out[3]= {{0, -}, {-, -}, {-, -}, {-, 1}} 9 9 3 3 9 9 -- ..STeve ------------------------------------ Insert pithy maxim here... steve at tweedledee.ucsb.edu (NeXT mail)