Calculate the slope for every segment connecting pairs of neighbor points. If the slopes are the same, the given function is linear.