$pointset = array(
array(10, 0.45),
array(10, 0.45),
array(3.091,12.9),
array(8.12,13.01),
array(6.23,8.731),
array(12.12,2.568),
array(9.51,5.89),
array(7.67,11.901)
);
$y = array(0,0);
for($i = 0; $i < 20; $i++){
$y = algorithm($pointset, $y);
echo $y[0] . ',' . $y[1] . '<br />';
}
function algorithm($pointset, $y){
$s1 = array(0,0);
$s2 = 0;
foreach ($pointset as $point) {
$norm = Eucnorm(array($point[0] - $y[0], $point[1] - $y[1] ));
$s1[0] += $point[0] / $norm;
$s1[1] += $point[1] / $norm;
$s2 += 1 / $norm;
}
return array($s1[0]/ $s2, $s1[1] / $s2);
}
function Eucnorm($v){
return sqrt(($v[0] * $v[0] + $v[1] * $v[1]));
}
And the output is:
8.4694229958382,6.3750562923086
8.7391111370073,6.5636031962359
8.7786455894498,6.5618090919414
8.7943588659231,6.5449477143646
8.8070652809877,6.5284004270569
8.8185637197715,6.5132713529887
8.8290814816784,6.4995149942758
8.8387123815852,6.4870066624231
8.8475329199354,6.4756275801103
8.8556122056453,6.4652704538268
8.8630132953696,6.4558387585837
8.8697937889668,6.4472456393321
8.8760063177511,6.4394128933972
8.8816989826087,6.4322700597592
8.8869157513509,6.4257536067247
8.8916968199918,6.4198062077897
8.8960789416409,6.4143760962772
8.9000957261516,6.4094164902423
8.9037779132619,6.4048850799758
8.9071536216511,6.4007435712189