# Behavior of the norm function

Hello

I’m trying to understand the behavior of the norm function in dolfin.

Given a mixed vector function space, I compute a vector function, say U.

If I want to find its norm, what is the difference between norm(U) and norm(U.vector())? Both give me different results and I’m trying to understand why.

Thank you!

It sounds like you may be confusing two different notions of “vector” here. The functions in a VectorFunctionSpace are vector-valued, in the sense that they evaluate to a vector at each point in the domain. However, functions in finite element function spaces can be represented as vectors of coefficients scaling each basis function (e.g., a list of nodal values in a Lagrange finite element space). U.vector() refers to the latter notion of “vector”.

The function norm is overloaded to have different behaviors when given a function or a vector as its argument. If the norm of a Function is computed, it returns some Sobolev norm, defaulting to L^2, but optionally specified by a second string argument, as illustrated below:

from dolfin import *
mesh = UnitIntervalMesh(10)
V = VectorFunctionSpace(mesh,"CG",1,dim=2)
x = SpatialCoordinate(mesh)
u = project(as_vector((sin(pi*x[0]),cos(pi*x[0]))),V)
print(norm(u))
print(sqrt(assemble(inner(u,u)*dx)))
print(norm(u,"H1"))


If a vector is passed, norm computes some algebraic norm of the vector, defaulting, if I recall, to the Euclidean (or \ell^2) norm, i.e., the square root of the sum of the squares of the components.

1 Like

You must distinguish between the local norm of your physical vectorial field and its global norm when considering it as a vector of degrees of freedom. I think you are referring to the former so U_normalized = U/sqrt(dot(U, U)) is a normalized vectorial field.