Thanks for all, and especially @Rouben Rostamian . Your code is Ok:).
I have to apply it to a semicircular plate, whose boundary conditions are that the temperature is 0 along the diameter and 100 along the contour of the semicircle. In the The boundary conditions match the exact solution: from the code I wrote this
g:= (x,y)-> `if`(y=sqrt(1-x^2), 100, `if`(x=sqrt(1-y^2), 100,`if`(x=0, 0, 'procname'(args))));
Here is our solution: from the code:
x, y, w := algo_12_1([-1,1],[0,1],[6,3],1e-10,100):
Error, (in algo_12_1) unable to store '.2500000000*g(-1., HFloat(0.6666666666))+.2500000000*g(HFloat(-0.6666666667), 1.)' when datatype=float
but this is not well :(.