MathGroup Archive 2005

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

Search the Archive

Re: Maxima & Minima


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}}


  • Prev by Date: Re: Multiple Sums in Mathematica
  • Next by Date: Re: Form of a linear equation
  • Previous by thread: Re: Maxima & Minima
  • Next by thread: Re: Re: Maxima & Minima