Interesting. In Mathematica, how easy is it to use the various Cantor
solutions to do the following?
Cantor =: 3 : ', 1 0 1 */^:y ,1'
(+/%#)@Cantor"0 i.4 5
1 0.666667 0.444444 0.296296 0.197531
0.131687 0.0877915 0.0585277 0.0390184 0.0260123
0.0173415 0.011561 0.00770735 0.00513823 0.00342549
0.00228366 0.00152244 0.00101496 0.000676639 0.000451093
(2%3)^i.4 5
1 0.666667 0.444444 0.296296 0.197531
0.131687 0.0877915 0.0585277 0.0390184 0.0260123
0.0173415 0.011561 0.00770735 0.00513823 0.00342549
0.00228366 0.00152244 0.00101496 0.000676639 0.000451093
On Sat, Dec 2, 2017 at 7:50 AM, Murray Eisenberg <[email protected]>
wrote:
> AOn 1 Dec 2017 05:33:02 +0000,"Dabrowski, Andrew John" <
> [email protected] <mailto:[email protected]>> wrote:
> >
> > On 11/29/2017 11:40 PM, Roger Hui wrote:
> >> 2.5 Cantor Set
> >>
> >> Write a function to compute the Cantor set of order n, n>:0.
> >>
> >> Cantor 0
> >> 1
> >> Cantor 1
> >> 1 0 1
> >> Cantor 2
> >> 1 0 1 0 0 0 1 0 1
> >> Cantor 3
> >> 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 1
> >>
> >
> > In Mathematica:
> >
> > cantor[n_] := If[n == 0, {1},
> > cantor[n - 1] /. {0 -> Sequence[0, 0, 0], 1 -> Sequence[1, 0, 1]}]
>
>
> I also tried this in Mathematica. The quickest way is to use one of the
> “higher order” built-in (i.e., primitive) functions:
>
> SubstitutionSystem[{1 -> {1, 0, 1}, 0 -> {0, 0, 0}}, 1, 2]
> {{1}, {1, 0, 1}, {1, 0, 1, 0, 0, 0, 1, 0, 1}}
>
> Or one can go back to more basic built-in functions, much as Andrew John
> Dabrowski did:
>
> cStep[lis_] := Flatten[lis /. {1 -> {1, 0, 1}, 0 -> {0, 0, 0}}]
> NestList[cStep, {1}, 2]
> {{1}, {1, 0, 1}, {1, 0, 1, 0, 0, 0, 1, 0, 1}}
>
> Interestingly, Mathematica also has as a built-in function CantorMesh
> built, which directly returns a graphic display of a collection of
> subintervals in the construction of the Cantor ternary set, with the depth
> indicated by the argument supplied to it. Thus
>
> CantorMesh /@ Range[0, 2]
>
> returns as output a list of images — the original unit interval, the 1st
> and 3rd thirds of that interval, and the 1st, 3rd, 7th and 9th ninths of
> that interval. (I cannot include graphics here, but the output is show in
> my post at https://mathematica.stackexchange.com/questions/
> 161024/extract-cell-indicators-from-meshregion/161098#161098 .)
>
> ——
> Murray Eisenberg [email protected]
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower phone 240 246-7240 (H)
> University of Massachusetts
> 710 North Pleasant Street
> Amherst, MA 01003-9305
>
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm