import math


def avstdv(v):
	"""
	This function returns the average and the standard deviation of values of a given vector
	"""

	# Calculation of the arithmetic average
	average = 1. * sum(v) / len(v)

	# Calculation of the standard deviation
	stdv = 0.
	for i in v: stdv += ((i - average) * (i - average))
	stdv = math.sqrt(stdv/len(v))

	return average, stdv