You need to make a function that is able to evaluate the functions at any point (x,y) in the domain.
You should use an interpolator (for instance scipy.interpolate.interp2d — SciPy v1.7.1 Manual)
from scipy import interpolate
x = np.arange(-5.01, 5.01, 0.25)
y = np.arange(-5.01, 5.01, 0.25)
xx, yy = np.meshgrid(x, y)
z = np.sin(xx**2+yy**2)
f = interpolate.interp2d(x, y, z, kind='cubic')
def g(x):
return f(x[0], x[1])
u = dolfinx.fem.Function(V)
u.interpolate(g)