MathGroup Archive 1998

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

Search the Archive

Re: Sorting of Data Lists




CFreitas@swri.edu wrote:

> I have two equal length vector sets of data.  I wish to form a third vector
> whose elements are the minimum values from each component of the other two
> vectors; i.e., if a(i) < b(i), then c(i) = a(i), else c(i) = b(i).  I have
> tried many different methods within Mathematica 3.0 and have not been
> successful.  I would appreciate any suggestions as to how to accomplish this
> task.
> Thank you.
>
> Dr. Christopher J. Freitas
> Principal Engineer - Computational Mechanics
> Southwest Research Institute
> Voice: 210-522-2137, Fax: 210-522-3042

  You may try this:

c[a_,b_]:=Min /@ Transpose[{a,b}]

In[3]:=
a={1,2,3};
b={3,2,1};
c[a,b]
Out[3]=
{1,2,1}


Edward Neuman




  • Prev by Date: RE: 2nd level pure function
  • Next by Date: typesetting problem in Mathematica3 / NT
  • Prev by thread: Re: Sorting of Data Lists
  • Next by thread: RE: Sorting of Data Lists