Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,6 +0,0 @@
|
|||
generic
|
||||
type Scalar is digits <>;
|
||||
|
||||
with function A (N : in Natural) return Natural;
|
||||
with function B (N : in Positive) return Natural;
|
||||
function Continued_Fraction (Steps : in Natural) return Scalar;
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
function Continued_Fraction (Steps : in Natural) return Scalar is
|
||||
function A (N : in Natural) return Scalar is (Scalar (Natural'(A (N))));
|
||||
function B (N : in Positive) return Scalar is (Scalar (Natural'(B (N))));
|
||||
|
||||
Fraction : Scalar := 0.0;
|
||||
begin
|
||||
for N in reverse Natural range 1 .. Steps loop
|
||||
Fraction := B (N) / (A (N) + Fraction);
|
||||
end loop;
|
||||
return A (0) + Fraction;
|
||||
end Continued_Fraction;
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
with Ada.Text_IO;
|
||||
|
||||
with Continued_Fraction;
|
||||
|
||||
procedure Test_Continued_Fractions is
|
||||
type Scalar is digits 15;
|
||||
|
||||
package Square_Root_Of_2 is
|
||||
function A (N : in Natural) return Natural is (if N = 0 then 1 else 2);
|
||||
function B (N : in Positive) return Natural is (1);
|
||||
|
||||
function Estimate is new Continued_Fraction (Scalar, A, B);
|
||||
end Square_Root_Of_2;
|
||||
|
||||
package Napiers_Constant is
|
||||
function A (N : in Natural) return Natural is (if N = 0 then 2 else N);
|
||||
function B (N : in Positive) return Natural is (if N = 1 then 1 else N-1);
|
||||
|
||||
function Estimate is new Continued_Fraction (Scalar, A, B);
|
||||
end Napiers_Constant;
|
||||
|
||||
package Pi is
|
||||
function A (N : in Natural) return Natural is (if N = 0 then 3 else 6);
|
||||
function B (N : in Positive) return Natural is ((2 * N - 1) ** 2);
|
||||
|
||||
function Estimate is new Continued_Fraction (Scalar, A, B);
|
||||
end Pi;
|
||||
|
||||
package Scalar_Text_IO is new Ada.Text_IO.Float_IO (Scalar);
|
||||
use Ada.Text_IO, Scalar_Text_IO;
|
||||
begin
|
||||
Put (Square_Root_Of_2.Estimate (200), Exp => 0); New_Line;
|
||||
Put (Napiers_Constant.Estimate (200), Exp => 0); New_Line;
|
||||
Put (Pi.Estimate (10000), Exp => 0); New_Line;
|
||||
end Test_Continued_Fractions;
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
generic
|
||||
type Scalar is digits <>;
|
||||
|
||||
with function A (N : in Natural) return Natural;
|
||||
with function B (N : in Positive) return Natural;
|
||||
function Continued_Fraction_Ada95 (Steps : in Natural) return Scalar;
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
function Continued_Fraction_Ada95 (Steps : in Natural) return Scalar is
|
||||
function A (N : in Natural) return Scalar is
|
||||
begin
|
||||
return Scalar (Natural'(A (N)));
|
||||
end A;
|
||||
|
||||
function B (N : in Positive) return Scalar is
|
||||
begin
|
||||
return Scalar (Natural'(B (N)));
|
||||
end B;
|
||||
|
||||
Fraction : Scalar := 0.0;
|
||||
begin
|
||||
for N in reverse Natural range 1 .. Steps loop
|
||||
Fraction := B (N) / (A (N) + Fraction);
|
||||
end loop;
|
||||
return A (0) + Fraction;
|
||||
end Continued_Fraction_Ada95;
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
with Ada.Text_IO;
|
||||
|
||||
with Continued_Fraction_Ada95;
|
||||
|
||||
procedure Test_Continued_Fractions_Ada95 is
|
||||
type Scalar is digits 15;
|
||||
|
||||
package Square_Root_Of_2 is
|
||||
function A (N : in Natural) return Natural;
|
||||
function B (N : in Positive) return Natural;
|
||||
|
||||
function Estimate is new Continued_Fraction_Ada95 (Scalar, A, B);
|
||||
end Square_Root_Of_2;
|
||||
|
||||
package body Square_Root_Of_2 is
|
||||
function A (N : in Natural) return Natural is
|
||||
begin
|
||||
if N = 0 then
|
||||
return 1;
|
||||
else
|
||||
return 2;
|
||||
end if;
|
||||
end A;
|
||||
|
||||
function B (N : in Positive) return Natural is
|
||||
begin
|
||||
return 1;
|
||||
end B;
|
||||
end Square_Root_Of_2;
|
||||
|
||||
package Napiers_Constant is
|
||||
function A (N : in Natural) return Natural;
|
||||
function B (N : in Positive) return Natural;
|
||||
|
||||
function Estimate is new Continued_Fraction_Ada95 (Scalar, A, B);
|
||||
end Napiers_Constant;
|
||||
|
||||
package body Napiers_Constant is
|
||||
function A (N : in Natural) return Natural is
|
||||
begin
|
||||
if N = 0 then
|
||||
return 2;
|
||||
else
|
||||
return N;
|
||||
end if;
|
||||
end A;
|
||||
|
||||
function B (N : in Positive) return Natural is
|
||||
begin
|
||||
if N = 1 then
|
||||
return 1;
|
||||
else
|
||||
return N - 1;
|
||||
end if;
|
||||
end B;
|
||||
end Napiers_Constant;
|
||||
|
||||
package Pi is
|
||||
function A (N : in Natural) return Natural;
|
||||
function B (N : in Positive) return Natural;
|
||||
|
||||
function Estimate is new Continued_Fraction_Ada95 (Scalar, A, B);
|
||||
end Pi;
|
||||
|
||||
package body Pi is
|
||||
function A (N : in Natural) return Natural is
|
||||
begin
|
||||
if N = 0 then
|
||||
return 3;
|
||||
else
|
||||
return 6;
|
||||
end if;
|
||||
end A;
|
||||
|
||||
function B (N : in Positive) return Natural is
|
||||
begin
|
||||
return (2 * N - 1) ** 2;
|
||||
end B;
|
||||
end Pi;
|
||||
|
||||
package Scalar_Text_IO is new Ada.Text_IO.Float_IO (Scalar);
|
||||
use Ada.Text_IO, Scalar_Text_IO;
|
||||
begin
|
||||
Put (Square_Root_Of_2.Estimate (200), Exp => 0); New_Line;
|
||||
Put (Napiers_Constant.Estimate (200), Exp => 0); New_Line;
|
||||
Put (Pi.Estimate (10000), Exp => 0); New_Line;
|
||||
end Test_Continued_Fractions_Ada95;
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
identification division.
|
||||
program-id. show-continued-fractions.
|
||||
|
||||
environment division.
|
||||
configuration section.
|
||||
repository.
|
||||
function continued-fractions
|
||||
function all intrinsic.
|
||||
|
||||
procedure division.
|
||||
fractions-main.
|
||||
|
||||
display "Square root 2 approximately : "
|
||||
continued-fractions("sqrt-2-alpha", "sqrt-2-beta", 100)
|
||||
display "Napier constant approximately : "
|
||||
continued-fractions("napier-alpha", "napier-beta", 40)
|
||||
display "Pi approximately : "
|
||||
continued-fractions("pi-alpha", "pi-beta", 10000)
|
||||
|
||||
goback.
|
||||
end program show-continued-fractions.
|
||||
|
||||
*> **************************************************************
|
||||
identification division.
|
||||
function-id. continued-fractions.
|
||||
|
||||
data division.
|
||||
working-storage section.
|
||||
01 alpha-function usage program-pointer.
|
||||
01 beta-function usage program-pointer.
|
||||
01 alpha usage float-long.
|
||||
01 beta usage float-long.
|
||||
01 running usage float-long.
|
||||
01 i usage binary-long.
|
||||
|
||||
linkage section.
|
||||
01 alpha-name pic x any length.
|
||||
01 beta-name pic x any length.
|
||||
01 iterations pic 9 any length.
|
||||
01 approximation usage float-long.
|
||||
|
||||
procedure division using
|
||||
alpha-name beta-name iterations
|
||||
returning approximation.
|
||||
|
||||
set alpha-function to entry alpha-name
|
||||
if alpha-function = null then
|
||||
display "error: no " alpha-name " function" upon syserr
|
||||
goback
|
||||
end-if
|
||||
set beta-function to entry beta-name
|
||||
if beta-function = null then
|
||||
display "error: no " beta-name " function" upon syserr
|
||||
goback
|
||||
end-if
|
||||
|
||||
move 0 to alpha beta running
|
||||
perform varying i from iterations by -1 until i = 0
|
||||
call alpha-function using i returning alpha
|
||||
call beta-function using i returning beta
|
||||
compute running = beta / (alpha + running)
|
||||
end-perform
|
||||
call alpha-function using 0 returning alpha
|
||||
compute approximation = alpha + running
|
||||
|
||||
goback.
|
||||
end function continued-fractions.
|
||||
|
||||
*> ******************************
|
||||
identification division.
|
||||
program-id. sqrt-2-alpha.
|
||||
|
||||
data division.
|
||||
working-storage section.
|
||||
01 result usage float-long.
|
||||
|
||||
linkage section.
|
||||
01 iteration usage binary-long unsigned.
|
||||
|
||||
procedure division using iteration returning result.
|
||||
if iteration equal 0 then
|
||||
move 1.0 to result
|
||||
else
|
||||
move 2.0 to result
|
||||
end-if
|
||||
|
||||
goback.
|
||||
end program sqrt-2-alpha.
|
||||
|
||||
*> ******************************
|
||||
identification division.
|
||||
program-id. sqrt-2-beta.
|
||||
|
||||
data division.
|
||||
working-storage section.
|
||||
01 result usage float-long.
|
||||
|
||||
linkage section.
|
||||
01 iteration usage binary-long unsigned.
|
||||
|
||||
procedure division using iteration returning result.
|
||||
move 1.0 to result
|
||||
|
||||
goback.
|
||||
end program sqrt-2-beta.
|
||||
|
||||
*> ******************************
|
||||
identification division.
|
||||
program-id. napier-alpha.
|
||||
|
||||
data division.
|
||||
working-storage section.
|
||||
01 result usage float-long.
|
||||
|
||||
linkage section.
|
||||
01 iteration usage binary-long unsigned.
|
||||
|
||||
procedure division using iteration returning result.
|
||||
if iteration equal 0 then
|
||||
move 2.0 to result
|
||||
else
|
||||
move iteration to result
|
||||
end-if
|
||||
|
||||
goback.
|
||||
end program napier-alpha.
|
||||
|
||||
*> ******************************
|
||||
identification division.
|
||||
program-id. napier-beta.
|
||||
|
||||
data division.
|
||||
working-storage section.
|
||||
01 result usage float-long.
|
||||
|
||||
linkage section.
|
||||
01 iteration usage binary-long unsigned.
|
||||
|
||||
procedure division using iteration returning result.
|
||||
if iteration = 1 then
|
||||
move 1.0 to result
|
||||
else
|
||||
compute result = iteration - 1.0
|
||||
end-if
|
||||
|
||||
goback.
|
||||
end program napier-beta.
|
||||
|
||||
*> ******************************
|
||||
identification division.
|
||||
program-id. pi-alpha.
|
||||
|
||||
data division.
|
||||
working-storage section.
|
||||
01 result usage float-long.
|
||||
|
||||
linkage section.
|
||||
01 iteration usage binary-long unsigned.
|
||||
|
||||
procedure division using iteration returning result.
|
||||
if iteration equal 0 then
|
||||
move 3.0 to result
|
||||
else
|
||||
move 6.0 to result
|
||||
end-if
|
||||
|
||||
goback.
|
||||
end program pi-alpha.
|
||||
|
||||
*> ******************************
|
||||
identification division.
|
||||
program-id. pi-beta.
|
||||
|
||||
data division.
|
||||
working-storage section.
|
||||
01 result usage float-long.
|
||||
|
||||
linkage section.
|
||||
01 iteration usage binary-long unsigned.
|
||||
|
||||
procedure division using iteration returning result.
|
||||
compute result = (2 * iteration - 1) ** 2
|
||||
|
||||
goback.
|
||||
end program pi-beta.
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
proc calc(f, n) {
|
||||
var r = 0.0;
|
||||
|
||||
for k in 1..n by -1 {
|
||||
var v = f.pair(k);
|
||||
r = v(2) / (v(1) + r);
|
||||
}
|
||||
|
||||
return f.pair(0)(1) + r;
|
||||
}
|
||||
|
||||
record Sqrt2 {
|
||||
proc pair(n) {
|
||||
return (if n == 0 then 1 else 2,
|
||||
1);
|
||||
}
|
||||
}
|
||||
|
||||
record Napier {
|
||||
proc pair(n) {
|
||||
return (if n == 0 then 2 else n,
|
||||
if n == 1 then 1 else n - 1);
|
||||
}
|
||||
}
|
||||
record Pi {
|
||||
proc pair(n) {
|
||||
return (if n == 0 then 3 else 6,
|
||||
(2*n - 1)**2);
|
||||
}
|
||||
}
|
||||
|
||||
config const n = 200;
|
||||
writeln(calc(new Sqrt2(), n));
|
||||
writeln(calc(new Napier(), n));
|
||||
writeln(calc(new Pi(), n));
|
||||
|
|
@ -1,25 +1,23 @@
|
|||
(phixonline)-->
|
||||
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
|
||||
<span style="color: #008080;">constant</span> <span style="color: #000000;">precision</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">10000</span>
|
||||
with javascript_semantics
|
||||
constant precision = 10000
|
||||
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">continued_fraction</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">f</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">steps</span><span style="color: #0000FF;">=</span><span style="color: #000000;">precision</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #004080;">atom</span> <span style="color: #000000;">a</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">b</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">0</span>
|
||||
<span style="color: #008080;">for</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">=</span><span style="color: #000000;">steps</span> <span style="color: #008080;">to</span> <span style="color: #000000;">1</span> <span style="color: #008080;">by</span> <span style="color: #0000FF;">-</span><span style="color: #000000;">1</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #0000FF;">{</span><span style="color: #000000;">a</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">b</span><span style="color: #0000FF;">}</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">f</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000000;">res</span> <span style="color: #0000FF;">:=</span> <span style="color: #000000;">b</span> <span style="color: #0000FF;">/</span> <span style="color: #0000FF;">(</span><span style="color: #000000;">a</span> <span style="color: #0000FF;">+</span> <span style="color: #000000;">res</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
|
||||
<span style="color: #0000FF;">{</span><span style="color: #000000;">a</span><span style="color: #0000FF;">}</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">f</span><span style="color: #0000FF;">(</span><span style="color: #000000;">0</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">return</span> <span style="color: #000000;">a</span> <span style="color: #0000FF;">+</span> <span style="color: #000000;">res</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
function continued_fraction(integer f, steps=precision)
|
||||
atom a, b, res = 0
|
||||
for n=steps to 1 by -1 do
|
||||
{a, b} = f(n)
|
||||
res := b / (a + res)
|
||||
end for
|
||||
{a} = f(0)
|
||||
return a + res
|
||||
end function
|
||||
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">sqr2</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">return</span> <span style="color: #0000FF;">{</span><span style="color: #008080;">iff</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span><span style="color: #0000FF;">?</span><span style="color: #000000;">1</span><span style="color: #0000FF;">:</span><span style="color: #000000;">2</span><span style="color: #0000FF;">),</span><span style="color: #000000;">1</span><span style="color: #0000FF;">}</span> <span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
function sqr2(integer n) return {iff(n=0?1:2),1} end function
|
||||
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">nap</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">return</span> <span style="color: #0000FF;">{</span><span style="color: #008080;">iff</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span><span style="color: #0000FF;">?</span><span style="color: #000000;">2</span><span style="color: #0000FF;">:</span><span style="color: #000000;">n</span><span style="color: #0000FF;">),</span><span style="color: #008080;">iff</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">=</span><span style="color: #000000;">1</span><span style="color: #0000FF;">?</span><span style="color: #000000;">1</span><span style="color: #0000FF;">:</span><span style="color: #000000;">n</span><span style="color: #0000FF;">-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">)}</span> <span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
function nap(integer n) return {iff(n=0?2:n),iff(n=1?1:n-1)} end function
|
||||
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">pi</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">return</span> <span style="color: #0000FF;">{</span><span style="color: #008080;">iff</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span><span style="color: #0000FF;">?</span><span style="color: #000000;">3</span><span style="color: #0000FF;">:</span><span style="color: #000000;">6</span><span style="color: #0000FF;">),</span><span style="color: #7060A8;">power</span><span style="color: #0000FF;">(</span><span style="color: #000000;">2</span><span style="color: #0000FF;">*</span><span style="color: #000000;">n</span><span style="color: #0000FF;">-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">2</span><span style="color: #0000FF;">)}</span> <span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
function pi(integer n) return {iff(n=0?3:6),power(2*n-1,2)} end function
|
||||
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Precision: %d\n"</span><span style="color: #0000FF;">,</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">precision</span><span style="color: #0000FF;">})</span>
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Sqr(2): %.10g\n"</span><span style="color: #0000FF;">,</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">continued_fraction</span><span style="color: #0000FF;">(</span><span style="color: #000000;">sqr2</span><span style="color: #0000FF;">)})</span>
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Napier: %.10g\n"</span><span style="color: #0000FF;">,</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">continued_fraction</span><span style="color: #0000FF;">(</span><span style="color: #000000;">nap</span><span style="color: #0000FF;">)})</span>
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Pi: %.10g\n"</span><span style="color: #0000FF;">,</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">continued_fraction</span><span style="color: #0000FF;">(</span><span style="color: #000000;">pi</span><span style="color: #0000FF;">)})</span>
|
||||
<!--
|
||||
printf(1,"Precision: %d\n", {precision})
|
||||
printf(1,"Sqr(2): %.10g\n", {continued_fraction(sqr2)})
|
||||
printf(1,"Napier: %.10g\n", {continued_fraction(nap)})
|
||||
printf(1,"Pi: %.10g\n", {continued_fraction(pi)})
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
#Only print to 17 digits due to floating-point imprecision
|
||||
options(digits=17)
|
||||
|
||||
a_sqrt2 <- function(n) ifelse(n==1, 1, 2)
|
||||
b_sqrt2 <- function(n) return(1)
|
||||
|
||||
|
|
@ -9,16 +12,15 @@ b_pi <- function(n) (2*n-1)^2
|
|||
|
||||
continued_fraction <- function(a, b, n){
|
||||
frac <- function(x, d) a(x)+b(x)/d
|
||||
#Only print to 17 digits due to floating-point imprecision
|
||||
print(Reduce(frac, c(1:n,1), right=TRUE), digits=17)
|
||||
Reduce(frac, 1:n, 1, right=TRUE)
|
||||
}
|
||||
|
||||
print(sqrt(2), digits=17)
|
||||
sqrt(2)
|
||||
continued_fraction(a_sqrt2, b_sqrt2, 100)
|
||||
|
||||
print(exp(1), digits=17)
|
||||
exp(1)
|
||||
continued_fraction(a_e, b_e, 100)
|
||||
|
||||
print(pi, digits=17)
|
||||
pi_ests <- sapply(cumprod(c(100, rep(10,3))),
|
||||
function(n) continued_fraction(a_pi, b_pi, n))
|
||||
pi
|
||||
sapply(cumprod(c(100, rep(10,3))),
|
||||
function(n) continued_fraction(a_pi, b_pi, n))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
-- 28 Jul 2025
|
||||
include Settings
|
||||
-- 23 Aug 2025
|
||||
include Setting
|
||||
numeric digits 30
|
||||
|
||||
say 'CONTINUED FRACTION'
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
# Evaluates some interesting continued fractions.
|
||||
|
||||
Cfrac! ← +⊢^!0∧(÷:⊙+:°⊟)⊙0≡^!^.+1⇌⇡
|
||||
Fsqrt₂ ← [⊃(+1>0)⋅1]
|
||||
Fe ← [⊃(⨬⋅2∘>0.|⨬⋅1-1>1.)]
|
||||
Fpi ← [⊃(×3+1>0|ⁿ2-1×2)]
|
||||
&p$"√2 = _"Cfrac!Fsqrt₂ 200
|
||||
&p$"e = _"Cfrac!Fe 200
|
||||
&p$"π = _"Cfrac!Fpi 200
|
||||
F‼ ← +^0 0⊙◌⍢(⊙-₁÷+⊙⊸⊃^0^1|⋅±) 0
|
||||
&p$"√2 = _" F‼(+1>₀|⋅1) 10
|
||||
&p$"e = _" F‼(⨬⋅2∘⊸>₀|⨬⋅1-₁⊸>₁) 10
|
||||
&p$"π = _" F‼(×3+1>₀|ⁿ2-1×2) 100
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue