One example for curve is shown as below. The elbow point might be x=3 or 4. How to compute the elbow for a curve automatically and mathematically?
You might want to look for the point with the maximum absolute second derivative which, for a set of discrete points x[i]
as you have there, can be approximated with a central difference:
secondDerivative[i] = x[i+1] + x[i-1] - 2 * x[i]
As noted above, what you really want is the point with maximum curvature, but the second derivative will do, and this central difference is a good proxy for the second derivative.