How to get the partial derivative of the numerical solution?

Hello, everyone, may I ask a simple question? This question is confusing me. I’m trying to output the partial derivative of the numerical solution.

V = FunctionSpace(mesh, …)
u= Function(V)

a=...
L=...
solve(a == L, u, bc)

If we obtain the numerical solution u, how to get the partial derivative of u, u_x and u_y ?

In legacy Dolfin, you can project u.dx(i) into a suitable function space. If u is a vector, det derivative of the ith component in the jth direction is u[i].dx(j).

If u is in a pth order Lagrange space, the derivative should be in DG p-1.

In DOLFINx, you can interpolate this quantity into a suitable space instead

Thank you for your help!