2
$\begingroup$

I am currently working on a computer science project where I have to evaluate charts. The charts are simple lines in a $x$ - $y$ coordinate-system, given by CSV files. The flatter the curve, the better for me. Now I am looking for an indicator for the "flatness" of this curves.

My first idea was to calculate the first derivative of the function and then calculate the average between two points. If this value is near $0$, then the function is pretty flat.

Is that a good idea? Is there any better solution?

  • 2
    How about [curvature](http://mathworld.wolfram.com/Curvature.html)?2011-09-16
  • 0
    > "The charts are simple lines in a x - y coordinate-system".... are those charts *lines* or *curves*? If lines, then [slope](http://en.wikipedia.org/wiki/Slope#Examples) is simple to compute.2012-03-08
  • 0
    By "flatness" do you mean "horizontal-ness" or "un-curved-ness"? If the former, then the average slope at the point isn't a *bad* choice, assuming slowly varying data. But consider three points in sequence that form a letter "V" --- is the bottom of the "V" flat?. If the latter, then consider curvature.2018-04-03
  • 0
    Take the 1st and the last points (sorted by $x$). Compute the linear function $f(x)=ax+b$ thought those 2 points. For the remaining points, compute the [standard deviation](https://en.wikipedia.org/wiki/Standard_deviation) between $(x_i, y_i)$ and $(x_i, f(x_i))$. If it's 0, then the points are on the line. This should be a good enough indicator of flatness.2018-04-03

0 Answers 0