Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

[Date Index] [Thread Index] [Author Index]

Search the Archive

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



  • Prev by Date: Looking for MMA Code/Modern Diff. Geom./Alfred Gray
  • Next by Date: Online documentation available?
  • Previous by thread: Re: Cantor set
  • Next by thread: Re: NDSolve problem