Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
32
Task/Metallic-ratios/Mathematica/metallic-ratios.math
Normal file
32
Task/Metallic-ratios/Mathematica/metallic-ratios.math
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
ClearAll[FindMetallicRatio]
|
||||
FindMetallicRatio[b_, digits_] :=
|
||||
Module[{n, m, data, acc, old, done = False},
|
||||
{n, m} = {1, 1};
|
||||
old = -100;
|
||||
data = {};
|
||||
While[done == False,
|
||||
{n, m} = {m, b m + n};
|
||||
AppendTo[data, {m, m/n}];
|
||||
If[Length[data] > 15,
|
||||
If[-N[Log10[Abs[data[[-1, 2]] - data[[-2, 2]]]]] > digits,
|
||||
done = True
|
||||
]
|
||||
]
|
||||
];
|
||||
acc = -N[Log10[Abs[data[[-1, 2]] - data[[-2, 2]]]]];
|
||||
<|"sequence" -> Join[{1, 1}, data[[All, 1]]],
|
||||
"ratio" -> data[[All, 2]], "acc" -> acc,
|
||||
"steps" -> Length[data]|>
|
||||
]
|
||||
Do[
|
||||
out = FindMetallicRatio[b, 32];
|
||||
Print["b=", b];
|
||||
Print["b=", b, " first 15=", Take[out["sequence"], 15]];
|
||||
Print["b=", b, " ratio=", N[Last[out["ratio"]], {\[Infinity], 33}]];
|
||||
Print["b=", b, " Number of steps=", out["steps"]];
|
||||
,
|
||||
{b, 0, 9}
|
||||
]
|
||||
out = FindMetallicRatio[1, 256];
|
||||
out["steps"]
|
||||
N[out["ratio"][[-1]], 256]
|
||||
Loading…
Add table
Add a link
Reference in a new issue