(* u = -(1/2)Cos[π(x+y)]+(1/2)Cos[π(x-y)] *)

u = -(1/2)Cos[π(x+y)]+(1/2)Cos[π(x-y)];
p=D[u,{x,1}];
q=D[u,{y,1}];

n=10;
lu=Table[u/.{x->1.0i/n,y->0.0},{i,0,n}];
lp=Table[p/.{x->1.0i/n,y->0.0},{i,0,n}];
lq=Table[q/.{x->1.0i/n,y->0.0},{i,0,n}];

lu

Clear[u,p,q]

a=1;
b=0;
c=-1;
e=0;

f=((b+(Sqrt[(b^2)-a c]))/a);
g=((b-(Sqrt[(b^2)-a c]))/a);

x1=0.0;
y1=0.0;
u1=0.0;
p1=0.0;
q1=0.0;
x2=0.1;
y2=0.0;
u2=0.0;
p2=0.0;
q2=0.9708055193627332;
cond1={x->x1,y->y1,u->u1,p->p1,q->q1};
cond2={x->x2,y->y2,u->u2,p->p2,q->q2};
f1=f/.cond1;
g2=g/.cond2;
a1=a/.cond1;
a2=a/.cond2;
c1=c/.cond1;
c2=c/.cond2;
e1=e/.cond1;
e2=e/.cond2;
sol=NSolve[{y-y1==(x-x1)f1,y-y2==(x-x2)g2},{x,y}];
x3=x/.sol[[1]];
y3=y/.sol[[1]];
sol=NSolve[{e1(x3-x1)f1-a1(p-p1)f1-c1(q-q1)==0,e2(x3-x2)g2-a2(p-p2)g2-c2(q-q2)==0},{p,q}];
q3=q/.sol[[1]];
p3=p/.sol[[1]];
u3=(1/2)(u1+(1/2)(x3-x1)(p1+p3)+(1/2)(y3-y1)(q1+q3)+u2+(1/2)(x3-x2)(p2+p3)+(1/2)(y3-y2)(q2+q3))

-(1/2)Cos[π(x+y)]+(1/2)Cos[π(x-y)]/.{x->x3,y->y3}