Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Thx 6. Suppose you have a blue and red parallel striped floor. Each stripe has equal thickness of t units. If you drop a matchstick

Thx
image text in transcribed
6. Suppose you have a blue and red parallel striped floor. Each stripe has equal thickness of t units. If you drop a matchstick of length on the floor, the probability that it will cross the border between two stripes can be computed as P-. Note, if x is the center of the needle to the closest line and the acute angle between the needle and the lines, then it can be shown analytically that a needle will cross a line if z S (a) (8 points) Create a function barPi,t,n) that uses the hit-or-miss method and the above for mulation to approximate the value o by simulating dropping many matchsticks onto the floor Assume that St and that >0 is the number of sampleseedles to drop. Be sure that your code checks that the parameters are appropriate and gives useful error messages, as well as return a value of 0 if no needle crosses a line (your calculation returs Inf)! The complete function needs no more than 4 lines of R code (b) (2 points) Create a function to return the mean and standard deviation of a vector of values. Only 1 line of R code (c) (6 points) Compare the mean/standard deviation (using your function from part (c)) for 1 0.5.08.1.0 (keeping t = 1 constant). You will simulate dropping 1000 needles for each experi- ment. What do you notice? Explain. One ne of R code per value, so 3 total lines of code 6. Suppose you have a blue and red parallel striped floor. Each stripe has equal thickness of t units. If you drop a matchstick of length on the floor, the probability that it will cross the border between two stripes can be computed as P-. Note, if x is the center of the needle to the closest line and the acute angle between the needle and the lines, then it can be shown analytically that a needle will cross a line if z S (a) (8 points) Create a function barPi,t,n) that uses the hit-or-miss method and the above for mulation to approximate the value o by simulating dropping many matchsticks onto the floor Assume that St and that >0 is the number of sampleseedles to drop. Be sure that your code checks that the parameters are appropriate and gives useful error messages, as well as return a value of 0 if no needle crosses a line (your calculation returs Inf)! The complete function needs no more than 4 lines of R code (b) (2 points) Create a function to return the mean and standard deviation of a vector of values. Only 1 line of R code (c) (6 points) Compare the mean/standard deviation (using your function from part (c)) for 1 0.5.08.1.0 (keeping t = 1 constant). You will simulate dropping 1000 needles for each experi- ment. What do you notice? Explain. One ne of R code per value, so 3 total lines of code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 15th International Conference Dexa 2004 Zaragoza Spain August 30 September 3 2004 Proceedings Lncs 3180

Authors: Fernando Galindo ,Makoto Takizawa ,Roland Traunmuller

2004th Edition

3540229361, 978-3540229360

More Books

Students also viewed these Databases questions

Question

Analyze the impact of labor unions on health care.

Answered: 1 week ago

Question

Assess three motivational theories as they apply to health care.

Answered: 1 week ago

Question

Discuss the history of U.S. labor unions.

Answered: 1 week ago