As @blechta pointed out to me several times,
Expressions interpolate to linear function if the degree is not specified explicitly.
from dolfin import * mesh = UnitIntervalMesh(1) e1 = Expression("x*x") e2 = Expression("x*x", degree=2) print assemble(e1*dx(mesh)) print assemble(e2*dx(mesh))
Yikes! I bet this is a source of error for many Dolfin codes. (At least it is for me and one of my colleagues.)
How could we improve the situation?
- Make the default degree infinity, and warn or error out every time that integrals cannot be computed exactly.
- Make the degree argument mandatory.
- Warn if the degree argument is not specified.