I am playing around with a problem, and I feel like I am missing
a couple basic concepts, so I was wondering if anyone had
any quick suggestions:
If I have code which finds a shortest cycle which visits all points in a set:
loopdist=: +/@:(+/&.:*:"1)@:(- 1&|.)"2
sortloops=:{.@(/: loopdist)@({~ (!@<: A.&i. ])@#)"2
And I use this to generate some random quadrilaterals
(with coordinates of each chosen arbitrarily from some
linearly distributed range):
data=: sortloops (?.20 4 2$1000)+"1"_1(1000*4 5 #:i.20)
What are the odds that any given quadrilateral is
not concave?
require'plot'
plot j./"1 (,{.)"2 data
Thanks,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm