norm#

AnsMath.norm(obj, order='nrm2')#

Return the norm of an AnsMath object.

Parameters:
objAnsMat or AnsVec

AnsMath object to compute the norm from.

orderstr

Mathematical norm to use. The default is 'NRM2'. Options are:

  • 'NRM2': L2 (Euclidean or SRSS) norm.

  • 'NRM1': L1 (absolute sum) norm (vectors only).

  • 'NRMINF': Maximum norm.

nrmfloat

Norm of the matrix or the one or more vectors.

Examples

Compute the norm of an AnsMath vector.

>>> v = mm.ones(10)
>>> print (mm.norm(v))
>>> 3.1622776601683795