Monte Carlo methods: Difference between revisions
m
→{{header|Wren}}: Minor tidy
m (→{{header|Wren}}: Minor tidy) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1,733:
piMC 10^i.7
4 2.8 3.24 3.168 3.1432 3.14256 3.14014</syntaxhighlight>
'''Alternative Tacit Solution:'''
<syntaxhighlight lang="j">pimct=. (4 * +/ % #)@:(1 >: |)@:(? j. ?)@:($&0)"0
(,. pimct) 10 ^ 3 + i.6
1000 3.168
10000 3.122
100000 3.13596
1e6 3.1428
1e7 3.14158
1e8 3.14154</syntaxhighlight>
=={{header|Java}}==
Line 2,821 ⟶ 2,832:
=={{header|RPL}}==
≪ 0
RAND SQ RAND SQ + 1 < +
SWAP / 4 * ▼
▲ SWAP / 4 *
≫ '<span style="color:blue">MCARL</span>' STO
100
1000 <span style="color:blue">MCARL</span>
10000
100000 <span style="color:blue">MCARL</span>
{{out}}
<pre>
4: 3.
3: 3.
2: 3.
1: 3.
</pre>
Line 3,206 ⟶ 3,219:
{{trans|Kotlin}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="
import "./fmt" for Fmt
var rand = Random.new()
|