MathGroup Archive 2010

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

Search the Archive

Re: Question about Mathematica


Hello Dominic, im use a "For" for solving your trouble:

--------------------------------------------------------------------------- ---------------------------------------------
tablein = {{{1, 2}, {3, -1}, {2, -4}}, {{1, 2}, {4, -5}, {6, -8}}, {{2, -1},
{-2, -3}, {-4, 6}}};
mintable = {};
For[i = 1, i <= Length[tablein], i++,
 mini = Min[Drop[tablein[[i]], {}, {1}]];
 posi = Position[tablein[[i]], mini][[1, 1]];
 mintable = Append[mintable, Extract[tablein[[i]], posi]];
 ];
mintable
-------------------------------------------------------------------------------------------------------------------------

I hope this code will serve you, greetings.



Regards,

Francisco Ch=E1vez Contreras
Santiago, Chile







2010/1/15 Dominic <miliotodc at rtconline.com>

> 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: Re: More /.{I->-1} craziness
  • Next by Date: Re: More /.{I->-1} craziness
  • Previous by thread: Re: Question about Mathematica
  • Next by thread: Re: Question about Mathematica