MathGroup Archive 2009

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

Search the Archive

Find maxima in lists of data

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105772] Find maxima in lists of data
  • From: David <david.leipold at tu-ilmenau.de>
  • Date: Fri, 18 Dec 2009 06:23:01 -0500 (EST)

I need to find maxima in lists of numerical (measured) data. My basic idea is to apply Differences[] to the data and find pairs which differ in Sign[]. My working solution is:

AllMaxima[lst_] := 
  Flatten[Position[
    Partition[Differences[lst], 2, 1], {x_, y_} /; 
     Sign[x] > Sign[y]]];

which behaves as i want. Since it was hard to work this out, i ask myself whether i haved overlooked the simple solution. So does anybody know the really cool way to achieve this?

Greets!


  • Prev by Date: Printed Formulas
  • Next by Date: Bug with Regular Expression?
  • Previous by thread: Re: Printed Formulas
  • Next by thread: simplification rule for infinite sum