Here is an approach like Oleg's distance, but using Mahalanobis' distance. First, the covarance matrix is computed using the verb S.
sum =: +/ transpose =: |: ctr =: sum%# NB. centroid mnc =: ] -"1 ctr NB. meancorrected mp =: sum . * NB. matrix product sscp =: transpose mp ] SSCP =: s...@mnc S =: SSCP%# NB. covariance matrix S mean=: +/%# $pts=: <.(]-"1 mean) ~.|:+/&>?&.>(<3 1000)$&.>20 80 915 2 S pts 102.893 8.70906 8.70906 1617.97 Then we compute Oleg's measure 'meas' based on Mahalanobis' distance and view it and the pts as follows. $meas =: %:(mp(%.S pts)mp transpose)"2 1 pts 915 plot/:~meas viewmat (1 + (meas < 2)) fillmat pts On Sun, Oct 25, 2009 at 3:42 AM, Oleg Kobchenko <[email protected]> wrote: > How about some distant gravitational analogy. > Say, the measure of being peripheral for each point > is sum of inverse square of distances to each point. > > mean=: +/ % # > $pts=. <.(]-"1 mean) ~.|:+/&>?&.>(<3 1000)$&.>20 80 > > 'X Y'=: |:pts > sqdist=: ((X -/ X)^2) + (Y -/ Y)^2 > meas=: +/ %1+sqdist > > fillmat=: 4 : 'x(<"1(] -"1 <./)y)}(1+ (>./ - <./) y)$0' > > viewmat meas fillmat pts NB. galaxy with gravitation > > plot /:~meas NB. response curve > > NB. say, cut off is 3 > > viewmat (1 + meas < 2) fillmat pts NB. your perimeter > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
