Dear all,
I have read the “diff” explanation in the UFL documentation. Then I wrote a simple code to test the differentiation with respect to spatial coordinate. However when I run the following test code:

an error “ufl_legacy.log.UFLException: This integral is missing an integration domain” occurred.
Any help will be appreciated. Thank you very much in advance.

Sorry, I don’t get it. Let me change my question a little bit. Now I want to write a variational form in Fenics. It is $$F=\int_{\Omega}\frac{\partial u}{\partial(x-3)}\frac{\partial v}{\partial(y-8)}dx$$ (It is just a test so it has no physical meaning), where u is the trial function and v is the test function.
So I write it as:

from dolfin import *
mesh = UnitSquareMesh(5, 5)
V = FunctionSpace(mesh, "CG", 1)
u = TrialFunction(V)
v = TestFunction(V)
a1 = Expression("x[0]-3", degree=1)
a1 = variable(a1)
a2 = Expression("x[1]-8", degree=1)
a2 = variable(a2)
F = diff(u, a1) * diff(v, a2) *dx

However the same error occurred “This integral is missing an integration domain.”

That’s not like any partial derivative I’ve ever seen, and I doubt it has any mathematical sense. If you want \frac{\partial u}{\partial x} you can use u.dx(0), \frac{\partial u}{\partial y} then u.dx(1), and so on.