Benford's law: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (add SETL) |
Not a robot (talk | contribs) (add APL) |
||
Line 403: | Line 403: | ||
Benford: 0.046 actual: 0.045 |
Benford: 0.046 actual: 0.045 |
||
</pre> |
</pre> |
||
=={{header|APL}}== |
|||
{{works with|Dyalog APL}} |
|||
<syntaxhighlight lang="apl">task←{ |
|||
benf ← ≢÷⍨(⍳9)(+/∘.=)(⍎⊃∘⍕)¨ |
|||
fibs ← (⊢,(+/¯2↑⊢))⍣998⊢1 1 |
|||
exp ← 10⍟1+÷⍳9 |
|||
obs ← benf fibs |
|||
⎕←'Expected Actual'⍪5⍕exp,[1.5]obs |
|||
}</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Expected Actual |
|||
0.30103 0.30100 |
|||
0.17609 0.17700 |
|||
0.12494 0.12500 |
|||
0.09691 0.09600 |
|||
0.07918 0.08000 |
|||
0.06695 0.06700 |
|||
0.05799 0.05600 |
|||
0.05115 0.05300 |
|||
0.04576 0.04500</pre> |
|||
=={{header|Arturo}}== |
=={{header|Arturo}}== |