Expression depending on another Expression?

You can pass one Expression as a keyword argument to another Expression. There is no need to pass the argument x to the first Expression where it is used in the definition of the second one. See the following example:

from dolfin import *
from numpy import array

# Pass g as keyword argument to f:
g = Expression("x[0]",degree=1)
f = Expression("pow(g,2)",g=g,degree=2)

# Check results:
print(f(array([0.5,])))
print(assemble(f*dx(domain=UnitIntervalMesh(1))))
3 Likes