Changes between Version 16 and Version 17 of BuffonsNeedle
- Timestamp:
- 10/23/09 13:35:13 (5 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
BuffonsNeedle
v16 v17 9 9 We can take advantage of this to write a simulation to estimate π. 10 10 {{{ 11 #!fs x11 #!fss 12 12 probability = hits/n 13 13 pi_est = 2.0/probability … … 24 24 juxtaposition (of non-functions) indicates multiplication. 25 25 {{{ 26 #!fs x26 #!fss 27 27 needleLength = 20 28 28 numRows = 10 … … 45 45 transformed into a reduction, but we're not there yet. 46 46 {{{ 47 #!fs x47 #!fss 48 48 for i <- 1#3000 do 49 49 delta_X = random(2.0) - 1

