Re: array ordered

• To: mathgroup at smc.vnet.net
• Subject: [mg3198] Re: array ordered
• From: espen.haslund at fys.uio.no (Espen Haslund)
• Date: Sat, 17 Feb 1996 14:14:47 -0500
• Organization: Universitet i Oslo
• Sender: owner-wri-mathgroup at wolfram.com

```In article <4fpdl6\$f9r at dragonfly.wolfram.com>,
;>
;>I'll give a solution using only the first 3 thicknesses as an example,
;>to save space.  The code should work for the longer list as well.
;>
;>thick={0.48,0.71,1.41};
;>
;>Outer[List, ##]& @@ Table[{0,1}, {Length[thick]}]
;>{{{{0, 0, 0}, {0, 0, 1}}, {{0, 1, 0}, {0, 1, 1}}},
;>  {{{1, 0, 0}, {1, 0, 1}}, {{1, 1, 0}, {1, 1, 1}}}}
;>
;>Flatten[%, Length[thick]-1]
;>{{0, 0, 0}, {0, 0, 1}, {0, 1, 0}, {0, 1, 1},
;>  {1, 0, 0}, {1, 0, 1}, {1, 1, 0}, {1, 1, 1}}
;>
;>combos = Drop[%, 1]
;>{{0, 0, 1}, {0, 1, 0}, {0, 1, 1}, {1, 0, 0},
;>  {1, 0, 1}, {1, 1, 0}, {1, 1, 1}}
;>
;>{#.thick, #}& /@ combos
;>{{1.41, {0, 0, 1}}, {0.71, {0, 1, 0}}, {2.12, {0, 1, 1}}, {0.48, {1, 0,
0}},
;>  {1.89, {1, 0, 1}}, {1.19, {1, 1, 0}}, {2.6, {1, 1, 1}}}
;>
;>Sort[%]
;>{{0.48, {1, 0, 0}}, {0.71, {0, 1, 0}}, {1.19, {1, 1, 0}}, {1.41, {0, 0,
;1}},
;>  {1.89, {1, 0, 1}}, {2.12, {0, 1, 1}}, {2.6, {1, 1, 1}}}

Hi,

Your solution is obviously more elegant and general than my attempt.
However the combos are perhaps more easily obtained by:

combos = Map[IntegerDigits[#,2,Length[thick] ]&,Range[2^Length[thick]-1] ]

- Espen

==== [MESSAGE SEPARATOR] ====

```

• Prev by Date: Re: Integrals of Fourier Series
• Next by Date: Re: array ordered
• Previous by thread: Re: array ordered
• Next by thread: Re: array ordered