added center function to get the arithmetic center of an array