Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
21
Task/Nth-root/ALGOL-60/nth-root-1.alg
Normal file
21
Task/Nth-root/ALGOL-60/nth-root-1.alg
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
begin
|
||||
|
||||
comment - return the nth root of x to stated precision;
|
||||
real procedure nthroot(x, n, precision);
|
||||
value x, n, precision; real x, n, precision;
|
||||
begin
|
||||
real x0, x1;
|
||||
x0 := x;
|
||||
x1 := x / n;
|
||||
for x0 := x0 while abs(x1 - x0) > precision do
|
||||
begin
|
||||
x0 := x1;
|
||||
x1 := ((n-1)*x1 + x / x1 ** (n-1)) / n;
|
||||
end;
|
||||
nthroot := x1;
|
||||
end;
|
||||
|
||||
outstring(1,"Cube root of 81 =");
|
||||
outreal(1,nthroot(81, 3, 0.0000001));
|
||||
|
||||
end
|
||||
5
Task/Nth-root/ALGOL-60/nth-root-2.alg
Normal file
5
Task/Nth-root/ALGOL-60/nth-root-2.alg
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
real procedure nthroot(x, n);
|
||||
value x, n; real x, n;
|
||||
begin
|
||||
nthroot := exp(ln(x) / n);
|
||||
end;
|
||||
5
Task/Nth-root/ALGOL-60/nth-root-3.alg
Normal file
5
Task/Nth-root/ALGOL-60/nth-root-3.alg
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
real procedure nthroot(x, n);
|
||||
value x, n; real x, n;
|
||||
begin
|
||||
nthroot := x ** (1/n);
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue