This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

UFL L^1-Norm of a function

+1 vote
Is there any natural way to define with UFL the L ^ 1-Norm of a function's coefficients as a Functional? || u ||1 = sum(abs(u.vector()))

Can you place non-negative restrictions on the domain of this Functional?

Any help is appreciated!
asked Apr 18, 2014 by Andre Machado FEniCS User (1,040 points)

Hi Andre,

Could you please improve the formatting of your question?

Hi Marie, yes I could. I am looking for alternatives to using FEniCS project in
optimization problems. I need to minimize the L^1 norm (functional).

I know that L^2 norm can be defined as

    u = Function(V)
    F = Functional(inner(u, u)*dx)

But what about L^1 norm?

    ||u||1 = sum(abs(u.vector()))

Is there a natural way of defining this type of norm trough the ufl?

1 Answer

+2 votes
# The quadrature is not exact as integrand (in mathematical sense)
# is not polynomial - UFL, in fact, operates DOF-wise and keeps
# polynomial basis.
F = abs(u)*dx

# Customize quadrature
F = abs(u)*dx(None, {'quadrature_degre': 5})
answered Apr 29, 2014 by Jan Blechta FEniCS Expert (51,420 points)

Jan,
thanks for the help.

...