Data update

This commit is contained in:
Ingy döt Net 2025-02-27 18:35:13 -05:00
parent 8e4e15fa56
commit 72eb4943cb
1853 changed files with 35514 additions and 9441 deletions

View 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

View file

@ -0,0 +1,5 @@
real procedure nthroot(x, n);
value x, n; real x, n;
begin
nthroot := exp(ln(x) / n);
end;

View file

@ -0,0 +1,5 @@
real procedure nthroot(x, n);
value x, n; real x, n;
begin
nthroot := x ** (1/n);
end;