Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function arctg1(x, eps: real; N:integer): real;
- var zn,k,s:integer;
- sum,res,xx: real;
- begin
- sum:=0;
- s:=1;
- while N>s do
- begin
- if ((s-1)mod 2)=0 then //(-1)^(n-1)
- zn:=1
- else
- zn:=-1;
- xx:=x;
- if s<>1 then
- for k:=1 to 2*s-2 do
- xx:=xx*x;
- res:=zn*xx/(2*s-1);
- if abs(res)>eps then
- sum:=sum+res;
- s:=s+1;
- end;
- arctg1:=sum;
- end;
- var x, eps: real;
- i,n: integer;
- begin
- write('Vvedite x=');
- readln(x);
- write('Vvedite N=');
- readln(N);
- if (x>-1) and (x<1) and (n>=1) then
- begin
- for i := 1 to 6 do
- begin
- write('Vvedite epsilon=');
- readln(eps);
- writeLn('Znachene cosinusa ravno=', arctg1(x, eps, N):1:8);
- end;
- end
- else
- Write('(x>-1) and (x<1) and (n>=1)');
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment