Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -0,0 +1,21 @@
##
function calc(fun: integer-> (integer, integer); n: integer): decimal;
begin
var temp := decimal(0.0);
for var ni := n to 1 step -1 do
begin
var (a, b) := fun(ni);
temp := b / (a + temp);
end;
result := fun(0)[0] + temp;
end;
function fsqrt2(n: integer) := (if n > 0 then 2 else 1, 1);
function fnapier(n: integer) := (if n > 0 then n else 2, if n > 1 then n - 1 else 1);
function fpi(n: integer) := (if n > 0 then 6 else 3, (2 * n - 1) * (2 * n - 1));
println(calc(fsqrt2, 200));
println(calc(fnapier, 200));
println(calc(fpi, 10000));

View file

@ -0,0 +1,9 @@
# 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