##LocalDataExtrema
LocalDataExtrema
is a simple package providing some basic functionality
to locate the positions of extremums in a list of data points.
(* Mathematica package *) | |
BeginPackage["LocalDataExtrema`"] | |
(* Test version: 1.0.0 *) | |
PositionsOfLocalMinimum::usage = "PositionsOfLocalMinimum[lst] returns a list of poistions of local minima in lst"; | |
Begin["`Private`"] | |
PositionsOfLocalMinimum[lst_List] := | |
Flatten@Position[Partition[Sign[Differences@lst], 2, 1], {-1, 1}] + 1; | |
PositionsOfLocalMaximum[lst_List] := | |
Flatten@Position[Partition[Sign[Differences@lst], 2, 1], {1, -1}] + 1; | |
End[] | |
EndPackage[] | |
{ | |
"author"-> | |
{ | |
"name" -> "lshifr", | |
"email" -> "lshifr@gmail.com", | |
"url" -> "http://www.mathprogramming-intro.org" | |
}, | |
"name" -> "LocalDataExtrema", | |
"mathematica_version" -> "8.0+", | |
"description" -> "New description", | |
"url" -> "https://gist.github.com/4238023" | |
} |