Re: Re: Cantor set
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1090] Re: [mg995] Re: [mg891] Cantor set
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Sun, 14 May 1995 21:01:30 -0400
Richard Mercer <richard at seuss.math.wright.edu> gives the following
code for successive stages in constructing the ternary Cantor set
> CantorEndPoints[0] = {{0,1}};
> CantorEndPoints[n_]:=
> Join[CantorEndPoints[n-1]/3, CantorEndPoints[n-1]/3 + 2/3];
Richard:
We'd better avoid the doubling in this, by, for example
CantorEndPoints2[0] = {{0,1}};
CantorEndPoints2[n_]:=
Join[#1,#1+2/3]&[CantorEndPoints2[n-1]/3]
Timing[CantorEndPoints2[10]]//First
2.15 Second
Compared to
Timing[CantorEndPoints[10]]//First
16.15 Second
Allan Hayes
hay at haystack.demon.co.uk