Re: need help on this problem.



Hi,

Edward.Huerta@xxxxxxxxx wrote:
Hello,

I have an assignment for school. I'm looking for help and advise on how
to solve this. My professor is bad, meaning that she
can't explain correctly, her english is bad, and it's one of those
people that expect students to know everything.

First of all: Is your professor from Germany? (I'm asking because I think I understand the question, and my English is not so good (because I'm from Germany) ;-)


Anyhow:

well, this is the problem:

On a floor, parallel lines separated of a length L are drawn. When you
launch a pen of length L on this floor, the probability that it crosses
a line is 2/Pi.

OK, that is not so complicated, I think: You drop the pen several times (lets say N times). In some cases, the pen will cross a line, in other cases it will not. Lets say, it crosses the line in n cases.


Now, the theory says that the probability that the pen crosses the line is:

    n/N=2/Pi
<=> Pi=2*N/n

So, by throwing the pen a lot of times, you are able to approximate Pi.

> Suppose that you have a computer that has 64
processors. Write a program to compute Pi in java for that computer.
But run it on your computer.

OK, now you can throw the pen yourself, or you can write a simulation that simulates how a pen is thrown. There is a x-coord and an angle a which are randomly distributed. From x and a you can calculate if the pen crosses one of the lines (*). By repeating this N times, you can approximate Pi.


(*) I suppose, for calculating this simulation, you need Pi! ;-)

Ciao,
Ingo

.



Relevant Pages