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 would like to know how this function is named to find how to calculate it. I have a trend like this one and want to find the upper and lower lines, the red ones (as you can see I do not have a great level at mathematics :) ):

enter image description here

EDIT: A better image using a real chart (in this case i need the name or the algorithm to find the black lines)

enter image description here

EDIT2: I would define the function like: from a top in a given (t) trace a line to the next top that does not create a line that cross the function. From a down in a given (t) trace a line to the next down that does not creates a line that cross the function.

This will create multiple lines, I'm ok with that, like in the following picture: I did the question 'cos I thought that this should be something common, please, if it's the first time you see something like this tell me and I will create everything from scratch!

enter image description here

share|cite|improve this question
Are these straight lines? Then extrapolating them to the right, they will eventually meet and also cross over (i.e., the top red line will go below the bottom one). I am not sure if you want this "feature" or not. If you are ok with curves, then we can have curves that go on forever without crossing over. (I suppose we can also make them look like straight lines at small distances.) – Srivatsan Sep 21 '11 at 15:22
The word you're looking for might be "envelope"? – joriki Sep 21 '11 at 15:24
I'm looking for the two red lines that goes over the maximums and minimums of the black line in a way that never cross the black line. Is something to find where the function is converging or if its diverging. – Ignacio Soler Garcia Sep 21 '11 at 15:28
As Srivatsan pointed out, if the graph were to extend further to the right, the lines would cross and could therefore no longer bound the graph; so I assume you intend the graph to be only what you've shown. In that case, note that the lines that you've drawn aren't uniquely defined. For instance, the upper red line in the first example could be drawn to pass through the two rightmost maxima instead, and likewise for the lower red line and the rightmost minima. The black lines, too, could be chosen differently. Any two maxima/minima on the convex hull of the graph could be chosen. – joriki Sep 21 '11 at 16:06
up vote 3 down vote accepted

From your second edit, it appears that you are looking for lines bounding the convex hull of the graph. There are various algorithms for computing the convex hull of a set of points.

share|cite|improve this answer
Mmm, nice. That's a real good point. It's like finding the envelope that will contain the graph with the less lines possible, am I right? – Ignacio Soler Garcia Sep 21 '11 at 16:54
@SoMoS: I presume you mean the fewest lines possible. I don't see how a notion of minimizing the number of lines enters here. You can use fewer lines by "cutting some of the corners"; in fact any finite set of points is contained in some triangle. The convex hull minimizes not the number of lines used but the region enclosed in them; it is the smallest convex region containing the given set of points, or, equivalently, the intersection of all convex regions containing the given set of points. – joriki Sep 21 '11 at 16:59
Ey, thanks. Really. Of course I meant fewer, I'm not a native english speaker. – Ignacio Soler Garcia Sep 21 '11 at 19:43
@SoMoS: The difference was not only between "less" and "fewer" (uncountable vs. countable), but also between "less/fewer" and "least/fewest" (comparative vs. superlative). – joriki Sep 21 '11 at 20:12
Again, you're right :) – Ignacio Soler Garcia Sep 21 '11 at 20:43

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.