Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

Using Fold in Select

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9035] Using Fold in Select
  • From: Ramin Sina <sina at glue.umd.edu>
  • Date: Wed, 8 Oct 1997 00:05:32 -0400
  • Organization: University of Maryland, College Park
  • Sender: owner-wri-mathgroup at wolfram.com

Hi all,

I am trying to write a fuction that does the following:

f[n_]:=Select[thedata,(
          #[[1]]<fitmax[1,g[n]]  &&
          #[[2]]<fitmax[2,g[n]]  &&
           ...................   &&
          #[[n]]<fitmax[n,g[n]] 
                       ) &]

thedata is a 100 by 1000 matrix. I tried to use a Fold of the And
functions:

f[n_]:=Select[thedata, 
           (Flatten[Fold[And,1,temp[n]]])
          &   ]

where  temp[n] is defined by

For[i=nmin,i<=nmax,i++,
         
temp[i]={};		                                                               
          For[j=1,j<=i,j++,             
               
AppendTo[temp[i],				                                                   
                          #[[j]]<fitmax[j,g[i]]  
                        ]
             ]
   ]

But this obviously won't work because #[[j]] is not defined outside
"Select".
I also tried to use x[j] instead and the at the end do \.x[j]->#[[j]].
But 
that won't work either. Any advice on to write this function in a
correct
and compact form would be deeply appreciated.

Ramin Sina
-- 
--------------------------------------------------------
 Ramin Sina     sina at glue.umd.edu   rsina at concentric.net    
   
 Institute   for   Physical   Science   and   Technology  
 University of Maryland   College Park  Maryland   20742   
 Voice (301) 405 4852                 Fax (301) 314 9363


  • Prev by Date: Re: TensorRank
  • Next by Date: Re: Arg and Re instructions
  • Previous by thread: Palette Problems
  • Next by thread: Re: Using Fold in Select