MathGroup Archive 2010

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

Search the Archive

Re: Question about Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106548] Re: Question about Mathematica
  • From: "Norbert P." <bertapozar at gmail.com>
  • Date: Sat, 16 Jan 2010 06:10:05 -0500 (EST)
  • References: <hipld8$7po$1@smc.vnet.net>

Hi Dominic,

use Ordering with Part or Extract:

In[1]:= t={{{1,2},{3,-1},{2,-4}},{{1,2},{4,-5},{6,-8}},{{2,-1},{-2,-3},
{-4,6}}};

In[2]:= #[[First@Ordering[#,{2}]]]&/@t
Out[2]= {{2,-4},{4,-5},{-2,-3}}

In[3]:= Extract[#,Ordering[#,{2}]]&/@t
Out[3]= {{2,-4},{4,-5},{-2,-3}}

Even Sort will do:

In[4]:= Sort[#][[2]]&/@t
Out[4]= {{2,-4},{4,-5},{-2,-3}}

Best,
Norbert

On Jan 15, 4:00 am, "Dominic" <miliot... at rtconline.com> wrote:
> Hi.  Can someone help me with the following question:
>
> I have a table of a table of number pairs:
>
> {{{1,2),(3,-1),{2,-4)},{{1,2},{4,-5},{6,-8}},{{2,-1},{-2,-3},{-4,6}}}
>
> How may I find the minimum second element in each sub-table?  For
> example, the first sub-table is:
>
> {{1,2},{3,-1},{2,-4}}
>
> I would like to then extract the {2,-4} element from this item.  Then
> the {6,-8} from the second sub-table, then the {-2,-3} element from the
> last.
>
> Thank you,
> Dominic



  • Prev by Date: Re: Converting date strings to DateList format - a need
  • Next by Date: AstronomicalData - solar ecliptic longitude
  • Previous by thread: Re: Question about Mathematica
  • Next by thread: Re: Question about Mathematica