def unit_matrix(n):
	"""Creates an nxn unit matirx

	The unit matrix is a diagonal matrix whose diagonal is composed of 
	identity elements.  For example, unit_matrix(3) returns the matrix

		1 0 0
		0 1 0
		0 0 1
	"""
	m = Matrix(n)
	for i in xrange(m.rows()):
		m[(i,i)] = m.identity_element
	return m
Creates an nxn unit matirx

	The unit matrix is a diagonal matrix whose diagonal is composed of 
	identity elements.  For example, unit_matrix(3) returns the matrix

		1 0 0
		0 1 0
		0 0 1
	
recipes/Python/189971_Basic_Linear_Algebra_Matrix/recipe-189971.py