Re: Sorting of Data Lists
- To: mathgroup@smc.vnet.net
- Subject: [mg11036] Re: Sorting of Data Lists
- From: bawolk@ucdavis.edu (Bruce Wolk)
- Date: Wed, 18 Feb 1998 20:31:35 -0500
- Organization: University of California, Davis
- References: <6camtn$fe8@smc.vnet.net>
On 16 Feb 1998 19:51:03 -0500, 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 > The following should work. In[3]:= a={1,2,3,4,5} Out[3]= {1,2,3,4,5} In[4]:= b={0,3,3,5,1} Out[4]= {0,3,3,5,1} In[5]:= Map[Apply[Min,#]&,Transpose[{a,b}]] Out[5]= {0,2,3,4,1} Bruce