Throwing Buffon s Needle with Mathematica

Similar documents
Random Variables, Sampling and Estimation

S6880 #14. Variance Reduction Methods #2: Buffon s Needle Experiment

MATH 320: Probability and Statistics 9. Estimation and Testing of Parameters. Readings: Pruim, Chapter 4

EECS564 Estimation, Filtering, and Detection Hwk 2 Solns. Winter p θ (z) = (2θz + 1 θ), 0 z 1

The Random Walk For Dummies

Expectation and Variance of a random variable

6. Sufficient, Complete, and Ancillary Statistics

Approximate Confidence Interval for the Reciprocal of a Normal Mean with a Known Coefficient of Variation

G. R. Pasha Department of Statistics Bahauddin Zakariya University Multan, Pakistan

An Introduction to Randomized Algorithms

Department of Mathematics

On Random Line Segments in the Unit Square

This is an introductory course in Analysis of Variance and Design of Experiments.

Topic 9: Sampling Distributions of Estimators

5. INEQUALITIES, LIMIT THEOREMS AND GEOMETRIC PROBABILITY


Monte Carlo Integration

Double Stage Shrinkage Estimator of Two Parameters. Generalized Exponential Distribution

Discrete Mathematics for CS Spring 2008 David Wagner Note 22

Confidence interval for the two-parameter exponentiated Gumbel distribution based on record values

The z-transform. 7.1 Introduction. 7.2 The z-transform Derivation of the z-transform: x[n] = z n LTI system, h[n] z = re j

A proposed discrete distribution for the statistical modeling of

IIT JAM Mathematical Statistics (MS) 2006 SECTION A

Topic 9: Sampling Distributions of Estimators

The standard deviation of the mean

Using the IML Procedure to Examine the Efficacy of a New Control Charting Technique

The picture in figure 1.1 helps us to see that the area represents the distance traveled. Figure 1: Area represents distance travelled

Linear regression. Daniel Hsu (COMS 4771) (y i x T i β)2 2πσ. 2 2σ 2. 1 n. (x T i β y i ) 2. 1 ˆβ arg min. β R n d

CEE 522 Autumn Uncertainty Concepts for Geotechnical Engineering

Mathematical Modeling of Optimum 3 Step Stress Accelerated Life Testing for Generalized Pareto Distribution

Basics of Probability Theory (for Theory of Computation courses)

Chapter 6 Principles of Data Reduction

SAMPLING LIPSCHITZ CONTINUOUS DENSITIES. 1. Introduction

EXAMINATIONS OF THE ROYAL STATISTICAL SOCIETY

6 Sample Size Calculations

Goodness-Of-Fit For The Generalized Exponential Distribution. Abstract

Maximum likelihood estimation from record-breaking data for the generalized Pareto distribution

ON POINTWISE BINOMIAL APPROXIMATION

STAT Homework 1 - Solutions

Estimation of Gumbel Parameters under Ranked Set Sampling

Econ 325/327 Notes on Sample Mean, Sample Proportion, Central Limit Theorem, Chi-square Distribution, Student s t distribution 1.

FACULTY OF MATHEMATICAL STUDIES MATHEMATICS FOR PART I ENGINEERING. Lectures

Upper bound for ropelength of pretzel knots

o <Xln <X2n <... <X n < o (1.1)

Hypothesis Testing. Evaluation of Performance of Learned h. Issues. Trade-off Between Bias and Variance

A statistical method to determine sample size to estimate characteristic value of soil parameters

Topic 9: Sampling Distributions of Estimators

4. Partial Sums and the Central Limit Theorem

Chapter 6 Sampling Distributions

CHAPTER 4 BIVARIATE DISTRIBUTION EXTENSION

Lecture 6 Chi Square Distribution (χ 2 ) and Least Squares Fitting

Estimation for Complete Data

Quick Review of Probability

1 Inferential Methods for Correlation and Regression Analysis

4.1 Sigma Notation and Riemann Sums

Since X n /n P p, we know that X n (n. Xn (n X n ) Using the asymptotic result above to obtain an approximation for fixed n, we obtain

Lecture 6 Chi Square Distribution (χ 2 ) and Least Squares Fitting

Problems from 9th edition of Probability and Statistical Inference by Hogg, Tanis and Zimmerman:

Final Review for MATH 3510

Comparison Study of Series Approximation. and Convergence between Chebyshev. and Legendre Series

Optimally Sparse SVMs

Distribution of Random Samples & Limit theorems

CS284A: Representations and Algorithms in Molecular Biology

The Sampling Distribution of the Maximum. Likelihood Estimators for the Parameters of. Beta-Binomial Distribution

Properties and Hypothesis Testing

7-1. Chapter 4. Part I. Sampling Distributions and Confidence Intervals

CALCULUS BASIC SUMMER REVIEW

Statistical Inference (Chapter 10) Statistical inference = learn about a population based on the information provided by a sample.

Statistical Theory MT 2008 Problems 1: Solution sketches

This exam contains 19 pages (including this cover page) and 10 questions. A Formulae sheet is provided with the exam.

n n i=1 Often we also need to estimate the variance. Below are three estimators each of which is optimal in some sense: n 1 i=1 k=1 i=1 k=1 i=1 k=1

Quick Review of Probability

Direction: This test is worth 250 points. You are required to complete this test within 50 minutes.

The Minimum Distance Energy for Polygonal Unknots

Information-based Feature Selection

Access to the published version may require journal subscription. Published with permission from: Elsevier.

Linear Regression Demystified

Modeling and Estimation of a Bivariate Pareto Distribution using the Principle of Maximum Entropy

Stat 421-SP2012 Interval Estimation Section

Lecture 12: September 27

Exponential Families and Bayesian Inference

NOTES ON DISTRIBUTIONS

Chapter 5. Inequalities. 5.1 The Markov and Chebyshev inequalities

Problem Set 4 Due Oct, 12

Machine Learning for Data Science (CS 4786)

Problem Set 2 Solutions

Statistical Theory MT 2009 Problems 1: Solution sketches

11 Correlation and Regression

1 Introduction to reducing variance in Monte Carlo simulations

Mathematical Statistics - MS

Convergence of random variables. (telegram style notes) P.J.C. Spreij

Chapter 8: Estimating with Confidence

A Note on Box-Cox Quantile Regression Estimation of the Parameters of the Generalized Pareto Distribution

Confidence Interval for Standard Deviation of Normal Distribution with Known Coefficients of Variation

Econ 325 Notes on Point Estimator and Confidence Interval 1 By Hiro Kasahara

Introducing Sample Proportions

Chapter 9: Numerical Differentiation

ADVANCED SOFTWARE ENGINEERING

Lecture 2: Monte Carlo Simulation

Statistics 511 Additional Materials

Transcription:

The Mathematica Joural Throwig Buffo s Needle with Mathematica Eis Siiksara It has log bee kow that Buffo s eedle experimets ca be used to estimate p. Three mai factors ifluece these experimets: grid shape, grid desity, ad eedle legth. I statistical literature, several experimets depedig o these factors have bee desiged to icrease the efficiecy of the estimators of p ad to use all the iformatio as fully as possible. We wrote the package BuffoNeedle to carry out the most commo forms of Buffo s eedle experimets. I this article we review statistical aspects of the experimets, itroduce the package BuffoNeedle, discuss the crossig probabilities ad asymptotic variaces of the estimators, ad describe how to calculate them usig Mathematica. Itroductio Buffo s eedle problem is oe of the oldest problems i the theory of geometric probability. It was first itroduced ad solved by Buffo [1] i 1777. As is well kow, it ivolves droppig a eedle of legth l at radom o a plae grid of parallel lies of width d > l uits apart ad determiig the probability of the eedle crossig oe of the lies. The desired probability is directly related to the value of p, which ca the be estimated by Mote Carlo experimets. This poit is oe of the major aspects of its appeal. Whe p is treated as a ukow parameter, Buffo s eedle experimets ca be see as valuable tools i applyig the cocepts of statistical estimatio theory, such as efficiecy, completeess, ad sufficiecy. For istace, i order to obtai better estimators of p, Kedall ad Mora [2] ad Diacois [3] examie several aspects of the problem with a log eedle (l > d). Morto [4] ad Solomo [5] provide the geeral extesio of the problem. Perlma ad Wishura [6] ivestigate a umber of statistical estimatio procedures for p for the sigle, double, ad triple grids. I their study, they show that movig from sigle to double to triple grid, the asymptotic variaces of the estimators get smaller ad hece more efficiet estimators ca be obtaied. Wood ad Robertso [7] itroduce the cocept of grid desity ad provide a alterative idea. They show that Buffo s origial sigle grid is actually the most efficiet if the eedle legth is held costat (at the distace betwee lies o the sigle grid) ad the grids are chose to have equal grid desity (i.e., equal legth

72 Eis Siiksara of grid material per uit area). I [8], Wood ad Robertso ivestigate the ways of maximizig the iformatio i Buffo s experimets. We orgaize this article as follows. I the first three sectios, we review Buffo s experimets o sigle, double, ad triple grids ad their statistical issues. I the ext sectio, we itroduce the features of the package BuffoNeedle. The fuctios i the package implemet Mote Carlo experimets for the three types of grids. The results of each experimet are give i a table ad i a picture. Whe the umber of the eedles throw o each grid is large, very ice pictures exhibit the iterface betwee chace ad ecessity. I the last two sectios, we describe how to calculate the crossig probabilities i sigle- ad double-grid experimets ad the asymptotic variaces of the estimators for each grid usig Mathematica. Sigle-Grid Experimet The sigle-grid form is Buffo s well-kow origial experimet. A plae (table or floor) has parallel lies o it at equal distaces d from each other. A eedle of legth l (l < d) is throw at radom o the plae. Figure 1 shows a sigle grid with two eedles of legth l represetig two possible outcomes. The probabilities of crossig zero lies ad oe lie are p = 1-2 r q, p 1 = 2 r q, where r = l ê d ad q = 1 ê p. These results ca be foud i may probability ad statistics textbooks, for istace [5, 9, 1]. They are also explaied i the Calculatig the Crossig Probabilities i Sigle ad Double Grids sectio of this article. (1) d d Figure 1. Buffo s eedles o a sigle grid. From equatio (1), we ca write q = 1 p = p 1 2 r. (2)

Throwig Buffo s Needle With Mathematica 73 Let N 1 be the umber of times i idepedet tosses that the eedle crosses ay lie. The the proportio of crossigs p` 1, a poit estimator of p 1, becomes p` 1 = N 1 ê. Hece, we ca write the poit estimator of q i equatio (2) as q` p` 1 = 2 r = N 1 2 r. The radom variable N 1 is biomially distributed with the parameters ad p 1. q` is the uiformly miimum variace ubiased estimator (UMVUE). Furthermore, it is the maximum likelihood estimator (MLE) of q ad hece has 1% asymptotic efficiecy i this experimet [6]. The variace of q` is the Var Hq` L = Var N 1 2 r = p 1 H1 - p 1 L q H1-2 r ql = = q 4 r 2 2 r 2 1 r - 2 q, which is miimized by takig r as close as possible to 1. Choosig eedle legth l = d (r = 1) esures this purpose. I this case, the variace of q` becomes Var Hq` L = q 2 2 1 q - 2. I Buffo s experimets, the parameter of mai iterest is p rather tha q. The estimator of this parameter, p` = 1 ê q`, is called Buffo s estimator ad ca be obtaied from equatio (3) as p` = 2 r. p` 1 It ca also be expressed i terms of p` = N ê (3) (4) (5) (6) p` = 2 r 1 - p`, (7) where N is the umber of times i tosses that the eedle does ot cross ay lie. Usig equatio (6) or (7) ad Mote Carlo methods, we ca obtai empirical estimates of p for various values of r. The best estimate is expected at r = 1 (l = d). Stadard theory [11] esures that Buffo s estimator is a asymptotically ubiased, 1% efficiet estimator of 1 ê q. Applyig the delta method shows that its asymptotic variace is AVar Hp`L = p 2 2 K p r - 2O, (8)

74 Eis Siiksara which is, as expected, miimized at r = 1. For this value of r, the asymptotic variace of p` is AVar Hp`L = p 2 Hp - 2L. 2 If it is evaluated at p = 3.1416, we have AVar Hp`L = 5.63. (9) (1) Double-Grid Experimet I the double-grid experimet, also called the Laplace extesio of Buffo s problem, a plae is covered with two sets of parallel lies where oe set is orthogoal to the other. d d d d d Figure 2. Buffo s eedles o a double grid. I Figure 2, we see a double-grid plae ad three eedles of legth l crossig zero, oe, ad two lies. These crossig probabilities are p = 1 - r H4 - rl q, p 1 = 2 r H2 - rl q, (11) p 2 = r 2 q. Let N i be the umber of times i tosses that the eedle crosses exactly i lies (i =, 1, 2). Perlma ad Wichura [6] showed that the radom variable N 1 + N 2 is distributed biomially with the parameters ad m q ad is completely sufficiet for q where m is 4 r - r 2. They also showed that the radom variable q` = N 1 + N 2 m (12)

Throwig Buffo s Needle With Mathematica 75 is the UMVUE ad has 1% asymptotic efficiecy with the variace Var Hq` L = q l m - q. (13) As i the case of a sigle grid, the variace of q` is miimized by r = 1, or equivaletly by l = d. Replacig N 1 + N 2 with - N i the right-had side of equatio (12), we have q` = - N m = 1 m 1 - N = 1 - p` 4 r - r 2. (14) The Buffo s estimator, p` = 1 ê q`, ca be expressed as p` = 4 r - r 2, 1 - p` which ca be used to obtai empirical estimates of p. By the delta method, we ca obtai the asymptotic variace of p` as AVar Hp`L = p 2 I4 r - r 2 - pm, r Hr - 4L which is miimized at r = 1. For this value of r, it becomes Whe evaluated at p = 3.1416, it is AVar Hp`L = p 2 Hp - 3L. 3 AVar Hp`L =.466. Compare the last equatio with equatio (1). Buffo s estimator i the doublegrid experimet is 5.63 ê.466 > 12 times as efficiet as that i the sigle-grid experimet. (15) (16) (17) (18) Triple-Grid Experimet I the triple-grid experimet, a plae is covered with equilateral triagles of altitude d ad hece of side 2 d ë 3.

76 Eis Siiksara d d 2 d 3 Figure 3. Buffo s eedles o a triple grid. Figure 3 shows a triple-grid plae ad four eedles of legth l crossig zero, oe, two, ad three lies. I [7], the crossig probabilities are give as p = 1 + r 2 2-3 2 r 4-3 2 r q, p 1 = - 5 4 r 2 + 3 2 r 4-3 2 r q, p 2 = r 2-3 3 r 2 q, 4 p 3 = - r 2 4 + 3 3 r 2 q. 4 Let N i deote the umber of times i tosses that the eedle crosses exactly i lies (i =, 1, 2, 3). For this experimet, Perlma ad Wichura [6] ivestigated the radom variable N 1 + N 2 + N 3 which is distributed biomially with the parameters ad a q - 1 ê 2 where a = 3 r ê 2 I4-3 r ê 2M. They proposed, amog others, the followig ubiased estimator of q as a fuctio of N 1 + N 2 + N 3 (19) q` = 1 a N 1 + N 2 + N 3 + 1 2. (2)

Throwig Buffo s Needle With Mathematica 77 By replacig N 1 + N 2 + N 3 with - N, as i the other experimets, we obtai the same estimator as a fuctio of N q` = 1 a - N + 1 2 = 1 a 3 2 - p`. (21) The variace of q` is H2 a q - 3L H2 a q - 1L Var Hq` L =. 4 a 2 As i the cases of the sigle- ad double-grid experimets, the variace of q` is miimized by takig r = 1 (l = d). From equatio (21), Buffo s estimator ca be writte as (22) 2 a p` = = 3-2 p` 3 r I8-3 rm. 2 I3-2 p` M For this experimet, the asymptotic variace of Buffo s estimator is (23) AVar Hp`L = -K2 p 2 K-3 3 + po K-3 3 + 4 po K-24 + 3 3 r + 5 p ro K3 r K-8 + 3 ro + 2 p I2 + r 2 MOO ì K9 r K54 K64-16 3 r + 3 r 2 O + p 2 K512-128 3 r - (24) 27 r 2 + 96 3 r 3 + 27 r 4 O + 6 p K-32 3 + 168 r + 234 3 r 2-36 r 3 + 27 3 r 4 OOO. For r = 1 ad p = 3.1416, it is AVar Hp`L =.15781. Comparig this with equatios (1) ad (18), we ca ifer that Buffo s estimator i the triple-grid experimet is.466 ê.15781 > 29 times as efficiet as i the double-grid experimet ad 5.63 ê.15781 > 356 times as efficiet as i the sigle-grid experimet (see Table 1). Now, we ca coclude that whe we icrease the complexity of the grid, we ca obtai tighter estimators of p. Wood ad Robertso [7] ivestigated this coclusio. They itroduced the otio of grid desity, which is the average legth of grid i a uit area ad showed that whe the experimets are stadardized, Buffo s estimator i a sigle grid is the most efficiet. I their approach, whe d = 1, the sigle grid has uit grid desity, the double grid has grid desity of two, ad the triple grid has grid desity of three. Hece, the stadardizatio of experimets correspods to r = 1 i the sigle grid, r = 1 ê 2 i the double grid ad, fially, r = 1 ê 3 i the triple grid. Replacig these values of r i equatios (8), (16), ad (24) ad evaluatig them at p = 3.1416 yields the values of AVarHp`L give i Table 2. As Wood ad Robertso claimed, the tightest estimator is obtaied i the sigle-grid experimet. (25)

78 Eis Siiksara Grid Type Sigle Hr = 1L Double Hr = 1L Triple Hr = 1L AVarHp`L 5.63 ê.466 ê.15781 ê Table 1. Asymptotic variaces of Buffo s estimator for three grids. Grid Type Sigle Hr = 1L Double Hr = 1 ê 2L Triple Hr = 1 ê 3L AVarHp`L 5.63 ê 7.85 ê 5.91 ê Table 2. Asymptotic variaces of Buffo s estimator for three stadardized grids. The Package The BuffoNeedle package is desiged to throw eedles o sigle, double, ad triple grids. Copy the file BuffoNeedle.m (see Additioal Material) ito the Mathematica @ AddOs @ Applicatios folder. The followig commad loads the program. << BuffoNeedle.m I[18]:= There are three fuctios i this package: SigleGrid[,r], DoubleGrid[,r], ad TripleGrid[,r]. Here, is the umber of eedles ad r is the ratio of eedle legth to grid height (i.e., r = l ê d), where ca be ay iteger, while r is a real umber o the iterval H, 1D. SigleGrid[,r] implemets a sigle-grid Buffo s experimet. It gives a table showig the umber ad frequecy ratios of the two possible outcomes, together with the theoretical probabilities ad the estimate of p defied i equatio (7). The fuctio also gives a picture of the simulatio results. I the picture, the midpoits of the eedles crossig ay lie are colored red, while those of eedles crossig o lie are colored gree. The fuctios DoubleGrid[,r] ad TripleÖ Grid[,r] carry out similar processes for double ad triple grids, respectively. I the picture of a double-grid experimet, the midpoits of the eedles are colored gree, blue, ad red to show the three possible outcomes of zero, oe, ad two crossigs. The estimate of p i this experimet is defied i equatio (15). As i the other two cases, i a triple-grid experimet carried out by the fuctio TripleGrid[,r], the four possible outcomes of zero, oe, two, ad three crossigs are represeted by four differet colors of the midpoits of the eedles. The estimate of p give i the table is defied i equatio (23). For each grid, as gets larger, it could be expected that the differece betwee the estimated ad actual values of p would get smaller. You ca also check some statistical results discussed i the previous sectios by tryig differet values of r. Additioally, for large values of, very ice pictures that exhibit the iterface betwee radomess ad determiism ca be obtaied. Some examples for various values of ad r are give below.

Throwig Buffo s Needle With Mathematica 79 I[19]:= SigleGrid@1,.87D *** Results of throwig 1 eedles of legth l =.87.d o a sigle grid *** Zero Crossig Oe Crossig Number of Crossigs 4 6 Frequecy Ratio.4.6 Theoretical Probability.4461.5539 Estimate of Pi:2.9 Out[19]= I[2]:= DoubleGrid@15,.76D *** Results of throwig 15 eedles of legth l =.76.d o a double grid *** Zero Crossig Oe Crossig Two Crossigs Number of Crossigs 2 11 2 Frequecy Ratio.1333.7333.1333 Theoretical Probability.2162.6.1839 Estimate of Pi:2.84123 Out[2]=

8 Eis Siiksara I[21]:= TripleGrid@12,.7D *** Results of throwig 12 eedles of legth l =.7.d o a triple grid *** Zero Crossig Oe Crossig Two Crossigs Three Crossigs Number of Crossigs 2 8 2 Frequecy Ratio.1667.6667.1667 Theoretical Probability.117.5218.2874.811 Estimate of Pi:2.6726 Out[21]= I[22]:= SigleGrid@1,.91D *** Results of throwig 1 eedles of legth l =.91.d o a sigle grid *** Zero Crossig Oe Crossig Number of Crossigs 4145 5855 Frequecy Ratio.4145.5855 Theoretical Probability.427.5793 Estimate of Pi:3.1845 Out[22]=

Throwig Buffo s Needle With Mathematica I[23]:= 81 DoubleGrid@38,.85D *** Results of throwig 38 eedles of legth l =.85.d o a double grid *** Zero Oe Two Crossig Crossig Crossigs Number of Crossigs 5675 Frequecy Ratio.1493 Theoretical Probability.1477 23 577.624.6223 8748.232.23 Estimate of Pi:3.14756 Out[23]= I[24]:= TripleGrid@28, 1D *** Results of throwig 28 eedles of legth l = 1.d o a triple grid *** Zero Oe Two Three Crossig Crossig Crossigs Crossigs Number of Crossigs 97 7 Frequecy Ratio.3464.25 Theoretical Probability.3637.2464 16 392.5854.5865 458.161.1635 Estimate of Pi:3.14123 Out[24]=

82 Eis Siiksara Calculatig the Crossig Probabilities i Sigle ad Double Grids I this sectio, we show how to calculate the crossig probabilities i sigle- ad double-grid experimets usig Mathematica. Sigle-Grid Probabilities I the sigle-grid experimet, two idepedet radom variables with uiform distributio are defied to determie the relative positio of the eedle to the lies: the distace X of the eedle s midpoit to the closest lie ad the acute agle a formed by the eedle (or its extesio) ad the lie (Figure 4). It is see that X ca take ay value betwee ad d ê 2 ad a ca take ay value betwee ad p ê 2. The desity fuctios of X ad a are the give by I[25]:= gdist1 = UiformDistributioB:, d 2 >F; f X = PDF@gdist1, xd Out[26]= µ 2 d x d 2 I[27]:= gdist2 = UiformDistributioB:, Pi 2 >F; f a = PDF@gdist2, ad Out[28]= µ 2 p a p 2 Sice X ad a are idepedet, the joit desity fuctio is the product of the desity fuctio of X aloe ad the desity fuctio of a aloe: I[29]:= f X,a = 2 2 d p 4 Out[29]= d p for x d ê 2, a p ê 2. From Figure 4, it is clear that the eedle crosses the lie whe X l ê 2 si a. The probability of this evet is the pê2 Hlê2L*Si@aD I[3]:= p 1 = f X,a x a Out[3]= 2 l d p

Throwig Buffo s Needle With Mathematica 83 As there are two possible outcomes i the sigle-grid experimet, the probability that the eedle does ot cross ay lie is give by I[31]:= p = 1 - p 1 Out[31]= 1-2 l d p which ca alteratively be calculated by pê2 I[32]:= p = Out[32]= 1-2 l d p dê2 Hlê2L*Si@aD f X,a x a The probabilities p ad p 1 ca be writte as a fuctio of q ad r as i equatio (1). I[33]:= Out[33]= p ê. Pi Ø 1 q ê. l Ø r * d 1-2 r q I[34]:= Out[34]= p 1 ê. Pi Ø 1 q ê. l Ø r * d 2 r q d X a lê2 lê2 d Figure 4. The radom variables i the sigle-grid experimet. Double-Grid Probabilities I the double-grid experimet, three idepedet radom variables with uiform distributio ca be defied to determie the relative positio of the eedle to the lies: the distace X of the eedle s midpoit to the closest horizotal lie, the distace Y of the eedle s midpoit to the closest vertical lie, ad the acute agle a formed by the eedle ad the horizotal lie, as i Figure 5. It is see that X ad Y ca take ay value betwee ad d ê 2 ad a ca take ay value betwee ad p ê 2. The desity fuctios of X, Y, ad a are give by

84 Eis Siiksara I[38]:= gdist1 = UiformDistributioB:, d 2 >F; f X = PDF@gdist1, xd Out[39]= µ 2 d x d 2 I[4]:= f Y = PDF@gdist1, yd Out[4]= µ 2 d y d 2 I[41]:= gdist2 = UiformDistributioB:, Pi 2 >F; f a = PDF@gdist2, ad Out[42]= µ 2 p a p 2 As i the case of the sigle-grid experimet, the joit desity fuctio of X, Y, ad a is the product of the desity fuctios of X, Y, ad a: I[43]:= f X,Y,a = 2 2 2 d d p Out[43]= 8 d 2 p for x d ê 2, y d ê 2, a p ê 2. I the double-grid experimet, there are four possible outcomes: Ë The eedle crosses a horizotal lie while ot crossig a vertical lie. Ë The eedle crosses a vertical lie while ot crossig a horizotal lie. Ë The eedle crosses both a vertical lie ad a horizotal lie or, equivaletly, the eedle crosses two lies. Ë The eedle crosses either a vertical lie or a horizotal lie or, equivaletly, the eedle crosses o lie. The eedle crosses a horizotal lie but does ot cross a vertical lie whe X l ê 2 si a ad Y > l ê 2 cos a. The probability of this evet is give by pê2 I[44]:= p ê X Y = Out[44]= H2 d - ll l d 2 p dê2 Hlê2L*Cos@aD Hlê2L*Si@aD f X,Y,a x y a

Throwig Buffo s Needle With Mathematica 85 The eedle crosses a vertical lie but does ot cross a horizotal lie whe X > l ê 2 si a ad Y l ê 2 cos a. The probability of this evet is give by pê2 Hlê2L*Cos@aD I[45]:= pê X Y = Out[45]= H2 d - ll l d 2 p dê2 Hlê2L*Si@aD f X,Y,a x y a Thus, the probability that the eedle crosses exactly oe lie is I[46]:= p 1 = p X Y ê + p X ê Y Out[46]= 2 H2 d - ll l d 2 p The eedle crosses both the vertical lie ad the horizotal lie whe X l ê 2 si a ad Y l ê 2 cos a. The probability of this evet is pê2 Hlê2L*Cos@aD Hlê2L*Si@aD I[47]:= p 2 = f X,Y,a x y a Out[47]= l 2 d 2 p Fially, the eedle crosses either the vertical lie or the horizotal lie whe X > l ê 2 si a ad Y > l ê 2 cos a. The probability of this evet is pê2 I[48]:= p = dê2 Hlê2L*Cos@aD dê2 Hlê2L*Si@aD f X,Y,a x y a Out[48]= l H-4 d + ll 1 + d 2 p The probabilities p, p 1, ad p 2 ca be writte as fuctios of q ad r, as i equatio (11). I[49]:= p ê. Pi Ø 1 ê. l Ø r * d êê Simplify q Out[49]= 1-4 r q + r 2 q I[5]:= Out[5]= p 1 ê. Pi Ø 1 ê. l Ø r * d êê Simplify q -2 H-2 + rl r q I[51]:= p 2 ê. Pi Ø 1 ê. l Ø r * d êê Simplify q Out[51]= r 2 q

86 Eis Siiksara d X Y a d d d d Figure 5. The radom variables i the double-grid experimet. Delta Method ad Asymptotic Variace Let a radom variable Y be a fuctio of the radom variable X, that is, Y = HHX L. Whe the fuctio HHX L is oliear, it may ot be possible to compute the true mea ad the true variace of Y. Oe ca, however, calculate estimates of the true mea ad true variace. The delta method is a very useful way to fid such estimates [12, 13] ad is based o the Taylor expasio about the mea of X. Let the mea of X be m ad the variace s 2. The the Taylor expasio of the fuctio HHXL about m to the third term is H HXL = H HmL + H HX - ml + 1 2 H HX - ml 2. (26) Takig the expectatio of both sides, we obtai the approximate mea of Y = HHXL as AMea@H HXLD = E@H HXLD = H HmL + 1 2 H HmL s 2. (27) From the well-kow idetity of statistics Var@H HXLD = E 8H HXL - E@H HXLD< 2, the approximate variace, also called asymptotic variace, of Y = HHXL is AVar@H HXLD = @H HmLD 2 s 2. (28) (29) Thus, we ca say that the radom variable Y is distributed with the approximate mea HHmL + 1 ê 2 H HmL s 2 ad the approximate variace @H HmLD 2 s 2. Buffo s estimator is a oliear fuctio of the radom variable q` (p` = HHq` L = 1 ê q`); hece, the delta method ca be used to fid its asymptotic variace. From the previous sectios, for each grid, we kow EHq` L ad VarHq` L. The,

Throwig Buffo s Needle With Mathematica 87 i equatio (29), substitutig HHXL = p`, m = q, ad s 2 = VarHq` L from equatios (5), (13), ad (22), we ca obtai the asymptotic variaces of p` i equatios (8), (16), ad (24) for each grid. Alteratively, asymptotic variaces of p` ca be computed as follows [7, 11] AVar@p`D = @H HqLD 2. I HqL Here IHqL is the Fisher iformatio umber, give by Ap i HqLE 2 I HqL =, p i HqL i where p i HqL is the probability that the eedle crosses i lies. These probabilities give i equatios (1), (11), ad (19) actually defie a list for each grid as follows: I[53]:= ProbSigle = 81-2 r q, 2 r q<; ProbDouble = 91 - r H4 - rl q, 2 r H2 - rl q, r 2 q=; (3) (31) ProbTriple = :1 + r2 2-3 2 r 4-3 2 r q, - 5 4 r2 + 3 2 r 4-3 2 r q, r 2-3 3 4 r 2 q, - r2 4 + 3 3 4 r 2 q>; From equatios (3) ad (31), oe ca defie the followig fuctios to obtai the asymptotic variaces: I[56]:= HD@expr, vardl2 deriv@expr_, var_d := ; HexprL fisherifo@list_, var_d := Total@Table@deriv@list@@iDD, vard, 8i, Legth@listD<DD; HD@1 ê var, vardl 2 avar@list_, var_d := H fisherifo@list, vardl ; For each grid, therefore, the asymptotic variaces are I[59]:= avar@probsigle, qd Out[59]= I[6]:= Out[6]= 1 q 4 J 2 r q + 4 r2 1-2 r q N avar@probdouble, qd q 4 J 2 H2-rL r q 1 + r2 q + H4-rL2 r 2 1-H4-rL r q N

88 Eis Siiksara I[61]:= avar@probtriple, qd 27 r 4 Out[61]= 1 ì q 4 + 16 Jr 2-3 3 r 2 qn 4 9 r 2 K4-3 r 2 O 2 + 4 K1 + r2-3 r K4-3 r O qo 2 2 2 16 J- r2 4 + 3 4 4 K- 5 r2 4 27 r 4 + 3 r 2 qn 9 r 2 K4-3 r 2 O 2 Substitutig q = 1 ê p ad factorig the expressios, we have + 3 r K4-3 r O qo 2 2 I[62]:= avar@probsigle, qd ê. q Ø 1 êê Factor p avar@probdouble, qd ê. q Ø 1 êê Factor p avar@probtriple, qd ê. q Ø 1 êê Factor p Out[62]= Out[63]= p 2 Hp - 2 rl 2 r - p2 Hp - 4 r + r 2 L H-4 + rl r Out[64]= -J2 p 2 J-3 3 + pn J-3 3 + 4 pn J-24 + 3 3 r + 5 p rn J4 p - 24 r + 3 3 r 2 + 2 p r 2 NN í J9 r J3456-192 3 p + 512 p 2-864 3 r + 18 p r - 128 3 p 2 r + 162 r 2 + 144 3 p r 2-27 p 2 r 2-1836 p r 3 + 96 3 p 2 r 3 + 162 3 p r 4 + 27 p 2 r 4 NN which were previously give i equatios (8), (16), ad (24), respectively. For r = 1 ad p = 3.1416, we obtai the same values give i Table 1 for each grid. I[65]:= avar@probsigle, qd ê. q Ø 1 ê. r Ø 1 ê. p Ø 3.1416 p Out[65]= 5.6336 I[66]:= avar@probdouble, qd ê. q Ø 1 ê. r Ø 1 ê. p Ø 3.1416 p Out[66]=.465848

Throwig Buffo s Needle With Mathematica 89 I[67]:= avar@probtriple, qd ê. q Ø 1 ê. r Ø 1 ê. p Ø 3.1416 p Out[67]=.15789 For the stadardized experimets of Wood ad Robertso [7], we ca obtai the asymptotic variaces give i Table 2 by substitutig r = 1, 1 ê 2, ad 1 ê 3 for sigle, double, ad triple grids, respectively. I[68]:= avar@probsigle, qd ê. q Ø 1 ê. r Ø 1 ê. p Ø 3.1416 p Out[68]= 5.6336 I[69]:= avar@probdouble, qd ê. q Ø 1 p ê. r Ø 1 ê. p Ø 3.1416 2 Out[69]= 7.84835 I[7]:= avar@probtriple, qd ê. q Ø 1 p ê. r Ø 1 ê. p Ø 3.1416 3 Out[7]= 5.9518 Ackowledgmets I would like to thak the reviewers whose commets led to a substatial improvemet i this article. I would also like to thak my colleague, M. H. Satma, for creatig some of the fuctios i the package BuffoNeedle. Thaks to Dr. Ayli Aktuku for readig ad commetig o umerous versios of this mauscript. This work is supported by the Scietific Research Projects Uit of Istabul Uiversity. Refereces [1] G. L. Buffo, Essai d arithmétique morale, Histoire aturelle, géérale, et particulière, Supplémet 4, 1777 pp. 685 713. [2] M. G. Kedall ad P. A. P. Mora, Geometrical Probability, New York: Hafer, 1963. [3] P. Diacois, Buffo s Problem with a Log Needle, Joural of Applied Probability, 13, 1976 pp. 614 618. [4] R. A. Morto, The Expected Number ad Agle of Itersectios Betwee Radom Curves i a Plae, Joural of Applied Probability, 3, 1966 pp. 559 562. [5] H. Solomo, Geometric Probability, Philadelphia: Society for Idustrial ad Applied Mathematics, 1978.

9 Eis Siiksara [6] M. D. Perlma ad M. J. Wichura, Sharpeig Buffo s Needle, America Statisticia, 29(4), 1975 pp. 157 163. [7] G. R. Wood ad J. M. Robertso, Buffo Got It Straight, Statistics ad Probability Letters, 37,1998 pp. 415 421. [8] G. R. Wood ad J. M. Robertso, Iformatio i Buffo Experimets, Joural of Statistical Plaig ad Ifereces, 66,1998 pp. 21 37. [9] M. R. Spiegel, Probability ad Statistics, Schaum s Outlie of Probability ad Statistics, New York: McGraw-Hill, 1975 pp. 67 68. [1] J. V. Uspesky, Itroductio to Mathematical Probability, New York: McGraw-Hill, 1937, p. 252. [11] C. R. Rao, Liear Statistical Iferece ad Its Applicatios, 2d ed., New York: Wiley & Sos, 1973. [12] G. W. Oehlert, A Note o the Delta Method, America Statisticia, 46, 1992 pp. 27 29. [13] J. A. Rice, Mathematical Statistics ad Data Aalysis, 2d ed., Belmot, CA: Duxbury Press, 1994 p. 149. Additioal Material BuffoNeedle.m Available at www.mathematica-joural.com/issue/v11i1/dowload. About the Author Eis Siiksara is a assistat professor at Istabul Uiversity, Departmet of Ecoometrics. His research iterests iclude geometric approaches to statistical methods, robust statistical methods, ad the methodology of ecoometrics. He has bee workig with Mathematica sice 1998. For details o his recet work dealig with the geometry of classical test statistics, i which all symbolic ad umerical computatios ad graphical work are doe usig Mathematica, see library.wolfram.com/ifoceter/articles/5962. Eis Siiksara Istabul Uiversitesi, Iktisat Fak., Ekoometri Bolumu Beyaz t, 34452, Istabul, Turkey sara@istabul.edu.tr