#NEWLINE# def quaternion_inverse( quaternion ) : #NEWLINE# #INDENT# 'Return inverse of quaternion.\n\n    >>> q0 = random_quaternion()\n    >>> q1 = quaternion_inverse(q0)\n    >>> numpy.allclose(quaternion_multiply(q0, q1), [1, 0, 0, 0])\n    True\n\n    ' #NEWLINE# q = numpy . array ( quaternion , dtype = numpy . float64 , copy = True ) #NEWLINE# numpy . negative ( q [ 1 : ] , q [ 1 : ] ) #NEWLINE# return ( quaternion / numpy . dot ( q , q ) )