program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Classes, Math
{ you can add units after this };
function y(x: Double): Double;
begin
Result := (1 + sqr(x))/2*ArcTan(x)-x/2;
end;
function s(x: Double): Double;
const
e:Double = 0.001;
var
pm, xx, ss: Double;
n: integer;
begin
Result := 0;
pm := 1;
xx := sqr(x)*x;
n := 1;
repeat
ss:=xx/(4*sqr(n)-1);
Result:=Result + pm*ss;
inc(n);
xx := xx * sqr(x);
pm := -pm;
until abs(ss)<e;
end;
const
xn: Double = 0.1;
xk: Double = 1.0;
m: Integer = 12;
var
x, h: Double;
n: integer;
begin
h:= (xk - xn) / m;
x := xn;
n:=1;
while (x <= xk) do
begin
WriteLn('s(',x,')=',s(x),', y(',x,')=',y(x));
x:=xn+h*n;
inc(n);
end;
Readln;
end.