Convex function
A differentiable function of one variable is convex on an interval if and only if its derivative is monotonically non-decreasing on that interval. If a function is differentiable and convex then it is also continuously differentiable. For the basic case of a differentiable function from (a subset of) the real numbers to the real numbers, "convex" is equivalent to "increasing at an increasing rate".
You can iterate over the points and check that the slope between each pair of successive points in the sequence is strictly non-decreasing. You don't have to connect each point to every other point.
Pseudo code:
boolean isConvex(float[] x, float[] y, int length)
{
float previousSlope = 0;
for(int i = 1; i < length; i++)
{
if(x[i] == x[i-1])
{
// handle infinite gradients to avoid div by zero
// if you are not going to exclude this case from your data
}
float slope = (y[i] - y[i-1]) / (x[i] - x[i-1]);
// only compare the slope after the first iteration:
if((i > 1) && (slope < previousSlope))
return false;
previousSlope = slope;
}
return true;
}
This assumes that y is a function of x, and that the values in the arrays are sorted into ascending order based on x and x is monotonically increasing.