Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Monte-Carlo-methods/Icon/monte-carlo-methods.icon
Normal file
14
Task/Monte-Carlo-methods/Icon/monte-carlo-methods.icon
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
procedure main()
|
||||
every t := 10 ^ ( 5 to 9 ) do
|
||||
printf("Rounds=%d Pi ~ %r\n",t,getPi(t))
|
||||
end
|
||||
|
||||
link printf
|
||||
|
||||
procedure getPi(rounds)
|
||||
incircle := 0.
|
||||
every 1 to rounds do
|
||||
if 1 > sqrt((?0 * 2 - 1) ^ 2 + (?0 * 2 - 1) ^ 2) then
|
||||
incircle +:= 1
|
||||
return 4 * incircle / rounds
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue