MathGroup Archive 2006

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

Search the Archive

Re: Any simple way to flatten all but the bottom level?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72392] Re: Any simple way to flatten all but the bottom level?
  • From: "Roman" <rschmied at gmail.com>
  • Date: Mon, 25 Dec 2006 04:52:13 -0500 (EST)
  • References: <emb4dh$950$1@smc.vnet.net><emdp3f$k38$1@smc.vnet.net>

Norbert,
I like your way best of all. Any ideas why Level[] allows for negative
levelspecs while Flatten[] does not? The first thing I had thought of
was to use Flatten[li,-1] meaning to flatten out everything but the
last level. This does not compute, though.
Schöni Wiehnacht!
Roman.


Norbert Marxer wrote:
> Hello
>
> The following will do what you want:
>
> li = {{0, 0, 0}, {{0, 0, 13}, {0, 1, 9}, {0, 2, 5}, {0, 3, 1}}, {{1, 0,
> 4}, {1, 1, 0}}};
>
> Level[ li, {-2}]
>
> Best Regards
> Norbert Marxer
>
> www.mec.li
>
>
> dontdont at gmail.com schrieb:
>
> > Am I overlooking something I should be able to see?
> >
> > When I Nest Table I sometimes produce things like this
> >
> > {{0, 0, 0}, {{0, 0, 13}, {0, 1, 9}, {0, 2, 5}, {0, 3, 1}}, {{1, 0, 4},
> > {1, 1, 0}}}
> >
> > where each triple is actually one solution I'm looking for.
> > But I don't see a simple way to transform this result into
> >
> > {{0, 0, 0}, {0, 0, 13}, {0, 1, 9}, {0, 2, 5}, {0, 3, 1}, {1, 0, 4}, {1,
> > 1, 0}}
> >
> > I would have guessed there would be a way to coax Flatten to do this.
> >
> > Thus far I haven't found what looks like a good method.
> > I have found a few awkward and bad ways but no simple clean way.
> > 
> > Would anyone enlighten me?
> > 
> > thanks


  • Prev by Date: Re: Re: GraphPlot display anomaly
  • Next by Date: RE: Re: GraphPlot display anomaly
  • Previous by thread: Re: Any simple way to flatten all but the bottom level?
  • Next by thread: Any simple way to flatten all but the bottom level?