I know approx what point i want from below diagram by looking at it(red circle), and im pretty sure there is some smart formula that does what im looking for, but how does the formula look like?

What kinds of math concept should i google on?

Each black dot represent a x/y coordinate, how can i find the range of dots that have the "steepest" angle between them? (aka find out "1." in image)

steepest angle in a range of coordinates


The closest term is the derivative. If you're dealing with a differentiable function, the higher the magnitude of the derivative, the higher the slope.

Your graph looks discontinuous though - in fact partially constant - so you will need an approximation of the derivative.

Take a look at the difference quotient, as described in the wiki article. Once you settle on the width of the region of interest, you can find the maximum magnitude of the difference quotient and that will be where the angle is high.

So examine the value of $\frac{f(x + h) - f(h)}{h}$ for some $h$ - the value of $x$ where it is highest (or lowest if you want downward slope) will indicate where the region with the highest slope starts.

A slight problem is the constant $h$ - if you were dealing with a differentiable function you could let it run to 0 at each point. If you make it too low for such data as you graphed, however, you will only register jumps between adjacent values, which may or may not be interesting to you. If you let it run to zero, you would get $\infty$ at each jump.

Try finding the maximum magnitude of the difference quotients for some values of $h$ and see if it gives you reasonable results - I would probably repeat the calculation for some range of $h$ to identify both longer and shorter regions with a pronounced slope.

  • 1
    $\begingroup$ Taking a numerical derivative, as t.dubrownik recommends (and it sounds to me like what you are looking for) amplifies noise in the data, particularly when $h$ is small. If this causes a problem, you will need to smooth the data first. Sections 3.1 through 3.3 of nr.com (the obsolete versions are free) give interpolation techniques that can smooth your data effectively. $\endgroup$ – Ross Millikan Mar 29 '11 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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