Monte Carlo methods: Difference between revisions
Content added Content deleted
Line 1,023: | Line 1,023: | ||
=={{header|EasyLang}}== |
=={{header|EasyLang}}== |
||
<syntaxhighlight lang="text"> |
<syntaxhighlight lang="text"> |
||
func mc n . |
|||
for i = 1 to n |
for i = 1 to n |
||
x = randomf |
x = randomf |
||
Line 1,031: | Line 1,031: | ||
. |
. |
||
. |
. |
||
return 4.0 * hit / n |
|||
. |
. |
||
numfmt 4 0 |
numfmt 4 0 |
||
print mc 10000 |
|||
print mc 100000 |
|||
print mc 1000000 |
|||
print mc 10000000 |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
Output: |
Output: |