Determine if a polygon is convex
J, 105

echo&gt;('concave';'convex'){~1=#=(o.1)([:&gt;-.~)(o.2)|3([:-/12 o.-@-/@}.,-/@}:)\(,2&amp;{.)j./"1}.0&amp;".;._2(1!:1)3


Passes all three tests above.

Edit: (111->115) Handle co-linear points by eliminating angles of pi. Gained a few characters elsewhere.

Edit: (115->105) Less dumb.

Explanation for the J-impaired:


(1!:1)3 read STDIN to EOF. (I think.)
0&amp;".;._2 is a nice idiom for parsing this kind of input.
j./"1}. lop off first line of input (N 0) and convert pairs to complexes.
(,2&amp;{.) tack first two points onto the end of the list.
3(f)\ applies f to  sliding window of length 3 (3 points for  an angle)
[:-/12 o.-@-/@}.,-/@}: is a verb that transforms each 3 points into an angle between -pi and pi.

-@-/@}.,-/@}: produces (p1 - p2),(p3 - p2). (Recall that these are complexes.)
12 o. gives an angle for each complex.
[:-/(...) gives the difference of the two angles.

(o.1)([:&gt;-.~)(o.2)| mod 2 pi, eliminate angles of pi (straight segments), and compare to pi (greater than, less than, doesn't matter unless the points are supposed to be wound in one direction).
1=#= if all those comparison result 1 or 0 (With self-classify. This seems dumb.)
echo&gt;('concave';'convex'){~ print convex.