September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
17
Task/Monte-Carlo-methods/Stata/monte-carlo-methods.stata
Normal file
17
Task/Monte-Carlo-methods/Stata/monte-carlo-methods.stata
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
program define mcdisk
|
||||
clear all
|
||||
quietly set obs `1'
|
||||
gen x=2*runiform()
|
||||
gen y=2*runiform()
|
||||
quietly count if (x-1)^2+(y-1)^2<1
|
||||
display 4*r(N)/_N
|
||||
end
|
||||
|
||||
. mcdisk 10000
|
||||
3.1424
|
||||
|
||||
. mcdisk 1000000
|
||||
3.141904
|
||||
|
||||
. mcdisk 100000000
|
||||
3.1416253
|
||||
Loading…
Add table
Add a link
Reference in a new issue