unit myunit;

interface
uses StdCtrls, SysUtils;
  type fun = function(x : extended):extended;
  procedure Tabl(f:fun; xn,xk,ee:extended; m:integer; Mem:TMemo);
  function my_fun(x:extended):extended;
  function my_sum(x:extended):extended;
implementation
var e:extended;
  procedure Tabl(f:fun; xn,xk,ee:extended; m:integer; Mem:TMemo);
     var x,y,h: extended;
         i : integer;
    begin
    mem.Lines.Add('xn='+floattostrf(xn,fffixed,8,2));
    mem.Lines.Add('xk='+floattostrf(xk,fffixed,8,2));
    mem.Lines.Add('m='+floattostrf(m,fffixed,8,2));
    mem.Lines.Add('e='+floattostrf(ee,fffixed,8,2));
    x:=xn;  h:=(xn-xk)/m; e:=ee;
 for i:=1 to m+1 do begin
     y:=f(x);
    Mem.Lines.Add(' x='+FloatToStrf(x,fffixed,8,3)+
                                ' y='+FloatToStrf(y,fffixed,8,3));
        x:=x+h;
                               end;
     end;
//*************************************
     function my_fun(x:extended):extended;
        begin
        my_fun:=sin(x)/x;
        end;
//**************************************
     function my_sum(x:extended):extended;
        var n,sum,sum2,elem:extended;
        begin
        elem:=1;
        sum:=1;
        n:=1;
        while abs(elem)>e do
                begin
                elem:=(-1)*elem*(sqr(x)/(2*n+2)/(2*n+3)-1);
                sum:=sum+elem;
                n:=n+1;
                end;
        my_sum:=sum;
        end;
end.
