Re: Maxima & Minima

*To*: mathgroup at smc.vnet.net*Subject*: [mg53758] Re: Maxima & Minima*From*: "Ray Koopman" <koopman at sfu.ca>*Date*: Wed, 26 Jan 2005 04:37:09 -0500 (EST)*References*: <200501240837.DAA28176@smc.vnet.net><ct56fb$eak$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

DrBob wrote: > Here's a complete list of local extrema in the raw data: > > data[[1+Flatten@Position[Partition[data[[All, 2]], 3, 1], > {a_, b_, c_} /; b < Min[a, c] || b > Max[a, c]]]] > > {{0.51, 1.30244}, > {0.53, 1.3059}, > {0.54, 1.30544}, > {0.58, 1.31146}, > {0.59, 1.31105}, > {0.66, 1.32175}, > {0.67, 1.32041}, > {0.83, 1.81008}, > {1.11, 0.0324386}, > {1.71, 1.72145}} > > (Too many, if we assume the data is only approximate.) That approach works fine (at least with this data) if we widen the window and look more than one point to the left and right: With[{k = 2}, data[[k + Flatten@Position[Partition[data[[All,2]],2k+1,1], x_List /; x[[k+1]] < Min[Delete[x,k+1]] || x[[k+1]] > Max[Delete[x,k+1]]]]]] will ignore the glitches and give {{0.83,1.81008},{1.11,0.0324386},{1.71,1.72145}}

**Follow-Ups**:**Re: Re: Maxima & Minima***From:*DrBob <drbob@bigfoot.com>

**References**:**Maxima & Minima***From:*nilaakash@gmail.com (nilaakash)