Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Command similar to flatten??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89277] Re: Command similar to flatten??
  • From: "David Park" <djmpark at comcast.net>
  • Date: Tue, 3 Jun 2008 06:44:46 -0400 (EDT)
  • References: <g22tpg$ikn$1@smc.vnet.net>

Erin,

Do you mean you want to contract the top two levels in the array? Then you 
want to use the 'trace' command Tr.

To contract the top two levels the command is:

Tr[A, Plus, 2]

You didn't say how you wanted to 'combine' the two levels and in general you 
might replace the Plus by a pure function that does the combining.

If it is not the top two levels that you wish to combine then you would have 
to use the Transpose command on A first to get the combining levels into the 
top two positions.

-- 
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/


"Erin Noel" <enoel2 at gmail.com> wrote in message 
news:g22tpg$ikn$1 at smc.vnet.net...
> Hi all,
>
> I am pretty new to Mathematica coding so bear with me...
>
> I have a list of lists named "A" whose dimensions are {4,10,1100,5} and I
> want to basically "combine" those first two levels so that the dimensions
> become {40,1100,5} but I have no idea how to do that...Any suggestions?
> Thanks a lot in advance.
>
> Erin
> 



  • Prev by Date: Re: Command similar to flatten??
  • Next by Date: Re: Log(ln) Function + 2 Parameters + Greater
  • Previous by thread: Re: Command similar to flatten??
  • Next by thread: Re: Command similar to flatten??