norm

dolfin.fem.norms.norm(v, norm_type='L2', mesh=None)

Return the norm of a given vector or function.

Arguments
v
a Vector or a Function.
norm_type
see below for alternatives.
mesh
optional Mesh on which to compute the norm.

If the norm type is not specified, the standard \(L^2\) -norm is computed. Possible norm types include:

Vectors

Norm Usage  
\(l^2\) norm(x, ‘l2’) Default
\(l^1\) norm(x, ‘l1’)  
\(l^\infty\) norm(x, ‘linf’)  

Functions

Norm Usage Includes the \(L^2\) -term
\(L^2\) norm(v, ‘L2’) Yes
\(H^1\) norm(v, ‘H1’) Yes
\(H^1_0\) norm(v, ‘H10’) No
\(H\) (div) norm(v, ‘Hdiv’) Yes
\(H\) (div) norm(v, ‘Hdiv0’) No
\(H\) (curl) norm(v, ‘Hcurl’) Yes
\(H\) (curl) norm(v, ‘Hcurl0’) No

Examples of usage

v = Function(V)
x = v.vector()

print norm(x, 'linf')   # print the infinity norm of vector x

n = norm(v)             # compute L^2 norm of v
print norm(v, 'Hdiv')   # print H(div) norm of v
n = norm(v, 'H1', mesh) # compute H^1 norm of v on given mesh