Dealing with removable singularities in cylindrical coordinates

Many thanks. I have found the another approach, which gives the same value as your proposed one.
It seems that the integral is performed with the same quadrature using the value of 1/r over inertial point. But, it is obvious that if the integral is done under polar coordinate, then a better result can be obtained.

I am wondering that is it possible to let FEniCS perform the integral under polar coordinate?

from dolfin import *
mesh = UnitSquareMesh(10,10)
x = SpatialCoordinate(mesh)
print("Integral by spatial coordinate: ", assemble(1/sqrt(x[0]*x[0]+x[1]*x[1]) * dx, form_compiler_parameters={‘quadrature_degree’: 20}))

Q=FiniteElement(“Quadrature”,triangle,degree=20,quad_scheme=‘default’)
sf = Expression("1/sqrt(x[0]*x[0]+x[1]x[1])", element=Q)
print("Integral by Quadrature element: ", assemble( sf
dx(mesh,degree=20)) )