program serie;

uses crt;

var p,n,m,i:integer; s,s1,t:real;

 

begin

writeln('Calcolo somme parziali serie Arctan x = x-(x3)/3+(x 5 )/ 5 - (x7 )/7+....+ [(-1)n-1)* (x 2n-1)/(2n-1)]con |x|<1');
writeln(' ridotte (pari), n=m ridotte (dispari) n e m=n-1 ');

readln(n,m);

z:=0.707106781;[z=1/sqrt(2)]

t:=0; i:=1;

while i<=n do

begin

t:=t+exp((4*i-3)*ln(z))/(4*i-3);

i:=i+1;

end;

writeln('t=',t:1:10);

s:=0; p:=1;

while p<=m do

begin

s:=s+exp((4*p-1)*ln(z))/(4*p-1);

p:=p+1;

end;

writeln('s=',s:1:10);

s1:=t-s;

writeln( 's1=',s1:1:10);

readln

end.