RE:Interrogating lists of unequal lenghths

• To: mathgroup at smc.vnet.net
• Subject: [mg67395] RE:Interrogating lists of unequal lenghths
• From: Mark_robert.holt at kcl.ac.uk
• Date: Wed, 21 Jun 2006 02:13:25 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Hi Kevin,
You need to 'Map' the Dimensions function over the list as follows:

In[2]:=
Map[Dimensions,x]

Out[2]=
{{1},{2},{4}}

or in short form:

In[3]:=
Dimensions /@ x

Out[3]=
{{1},{2},{4}}

Look up Map in the help browser.

If you had a more complex list, such as:

x = {{{1}, {2, 3}, {4, 5, 6, 7}}, {{1}, {2, 3}, {4, 5, 6}, {7}, {8, 9, 10}}};

then you could try:

In[4]:=
Table[Dimensions /@ x[[ i ]],{i,Length[x]}]

Out[4]=
{{{1},{2},{4}},{{1},{2},{3},{1},{3}}}

Hope that helps.

Mark

Link to the forum page for this post:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=11332#p11332
Posted through http://www.mathematica-users.org [[postId=11332]]

```

• Prev by Date: Re: Sturm-Liouville (eigenvalue/eigenfunction) problems
• Next by Date: Re: Interrogating lists of unequal lenghths
• Previous by thread: Re: Interrogating lists of unequal lenghths
• Next by thread: Re: Interrogating lists of unequal lenghths