program example5;
function f(x:double):double;
    begin
        f:=x*x-2
    end;
function df(x:double):double;
    begin
        df:=x*2
    end;
var i,N: integer;
var a, b, m, epsilon: double;
begin
    writeln('Calculation of the square root of 2');
    writeln('by the Newton Method.');
    epsilon:=0.5e-15;
    a:=2;
    repeat
       b:=f(a)/df(a);
       a:=a-b;
       writeln(a:18:15,b:18:15)
    until abs(b)<epsilon;
    writeln('Result : ',a:18:15);
    writeln('Theoretical value : ',sqrt(2.0):18:15);
end.

