I had started to create a procedure for finding the centroid of a list of points.

Centroid := proc (list)
local a, centroid, x, y, i:
a := nops(list):
x := 0:
yi := 0:
for i from 1 to a do
x := x+list[i, 1]:
y := y+list[i, 2]:
end do:
print(`Centroid is at`,([xi, yi]/a)):
end proc:

But I thought there needs to be something simpler than that.  And here we are.

Centroid2 := proc (list)
local i:
print(`Centroid is at`, add(i, i = list)/nops(list)):
end proc:


Please Wait...