Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm not a mathematician, however I would like to find the right approach for my attempts to deal with a range of numbers presented to me, for which I have to determine what, at any given time, represent the maximum and minimum values arriving, lowering the maximum should there be a significant number of values arriving which are still higher than those reflecting minimal or considerably lower values (IOW, monitoring and shifting if required, the max reference up or down, according to varying relative peaks and troughs in the input). Thank you.

share|cite|improve this question
Look at how the Dow Jones moves up and down: Relative minima or maxima occur on a daily basis, on weekly basis, &c. What criteria would you use to manually organize these min and max over the various time horizons? It's hard to say without knowing what problem you're trying to solve. – alancalvitti Sep 17 '12 at 14:33
Thanks. The problem I am trying to solve is simply to process any series of numbers - (but a series with some shape, by which I mean not just violently fluctuating adjacent values, with the exception of end-of-subseries differences). An 'example' could be this series e.g.: 70,70,70,75,65,55,60,70,70,74,3,4,5,2,0,11,12,4,3,9,60,60,60,65,55,45,50,60,60,6‌​4 . . . . where the first ten values max at 75, the second sub-series represents minima, for which I'd ideally like to know the maximum of that subseries (12), and the 3rd subseries new upper values, from which I'd like the lowest (45). – persephone Sep 17 '12 at 15:16

Given what you explained in the comment above and your sample data:

data = {70, 70, 70, 75, 65, 55, 60, 70, 70, 74, 3, 4, 5, 2, 0, 11, 12, 
  4, 3, 9, 60, 60, 60, 65, 55, 45, 50, 60, 60, 64};

This will yield the numbers you want:

If[EvenQ@First@#2, Max@#1, Min@#1] &~MapIndexed ~Partition[data, 10]

(* {55, 12, 45} *)

Note the implicit assumption that your data really is nicely partitioned into segments of 10 samples and that the first segment ("sub-series") is upper values.

Otherwise you may have to modify this to check some thresholds or other assumptions.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.