Derivative of P1 function

Dear FreeFem users,

I would like to ask please.
According to the documentation,

mesh Th=square(5,5);
fespace Vh(Th,P1);
Vh F = x*x;
Vh f = dx(F);

then the function f is returned as a P1 function.
For example, for node i, which is a vertex with multiple triangles, how is the value at node i of dx(F) calculated?
Derivatives are obtained on each element, but how can it be done at the nodes?

More simply, how is dx(F) computed at node i in the 1D case?
From my experiments, it seems to be determined by dx(F)(x_i)= (F(x_{i+1})-F(x_i))/(x_{i+1}-x_i).
It does not seem to be (F(x_{i+1})-F(x_{i-1}))/(x_{i+1}-x_{i-1}).

Thank you in advance,

Takehiro Matsumoto.

mesh Th=square(4,4); 
fespace Vh(Th,P1);
plot(Th,wait=1,ps="Th.eps");
Vh F = x*x;
Vh f = dx(F);
Vh fIdeal = 2*x;

{
  ofstream file("0calc_dx.txt");
  file << "F" << endl;
  file << F[] << endl;
  file << "f" << endl;
  file << f[] << endl;
  file << "fIdeal" << endl;
  file << fIdeal[] << endl;
}

Running this code, we can get the following result

F
25	
	  0	0.0625	0.25	0.5625	  1
	  0	0.0625	0.25	0.5625	  1
	  0	0.0625	0.25	0.5625	  1
	  0	0.0625	0.25	0.5625	  1
	  0	0.0625	0.25	0.5625	  1
	
f
25	
	0.25	0.75	1.25	1.75	1.75
	0.25	0.75	1.25	1.75	1.75
	0.25	0.75	1.25	1.75	1.75
	0.25	0.75	1.25	1.75	1.75
	0.25	0.75	1.25	1.75	1.75
	
fIdeal
25	
	  0	0.5	  1	1.5	  2
	  0	0.5	  1	1.5	  2
	  0	0.5	  1	1.5	  2
	  0	0.5	  1	1.5	  2
	  0	0.5	  1	1.5	  2

Remember freefem is not magic,

dx(F) is discontinus, so the value of dx(F)(x,y) at discontinuity point
not well defined, the algorithm find a element containing (x,y) dans give the value in this triangle, you can compute a L^2 projection of dx(F) on
P1 fespace if you want, but be careful.

Thank you so much.
Your answer have helped me a lot!