Henry,
some observations on the (intriguing for me) matrix-determinant part of:
isconvex=: ([:({.*./@:=}.)[:*1(-/ .*)@(1 1 1&,)\.])"2
1. the matrices you compose for calculating the determinants are not
square (but if I do understand the working of 'dot' then it's no problem
to use it this way in J)
2. the following variants produce the same result:
isconvex1 =. ([: ({. *./@:= }.) [: * 1 (-/ . *)@(,.&1 1 1)\. ])"2 NB.
square matrices
isconvex2=: ([: ({. *./@:= }.) [: * 1 -/ . *\. ])"2
points=:sortloops (?10000 4 2$1000)
(isconvex1-:isconvex)points
1
(isconvex2-:isconvex)points
1
ts 'isconvex points'
3.251488 22208
ts 'isconvex1 points'
0.225882 19264
ts 'isconvex2 points'
0.715514 20160
...interesting difference those last two (huh ??)
=@@i
Henry Rich schreef:
> Also, D cannot be freely chosen, because some positions of D will make
> ABCDA not minimal.
>
> isconvex =. ([: ({. *./@:= }.) [: * 1 (-/ . *)@(1 1 1&,)\. ])"2
>
> (+/ % #) isconvex sortloops (?.10000 4 2$1000)
> 0.6959
> (+/ % #) isconvex sortloops (?10000 4 2$1000)
> 0.6911
> (+/ % #) isconvex sortloops (?10000 4 2$1000)
> 0.6847
>
> close to 1 - 1%pi.
>
> Henry Rich
>
>
> Boyko Bantchev wrote:
>> 2008/12/10 John Randall <[email protected]>:
>>> My initial thought is this: Draw the first 3 sides A->B->C. Let D be the
>>> other vertex. Then ABCD is convex iff D lies on the opposite side of the
>>> line AC from B. This gives probability at least 1/2 for your question.
>> ABCD will still be concave if D is, e.g., on the opposite side of BC
>> from A.
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm