Re: need help on this problem.
- From: "Ingo R. Homann" <ihomann_spam@xxxxxx>
- Date: Thu, 08 Dec 2005 16:43:00 +0100
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
.
- Follow-Ups:
- Re: need help on this problem.
- From: Rhino
- Re: need help on this problem.
- From: Oliver Wong
- Re: need help on this problem.
- From: Edward . Huerta
- Re: need help on this problem.
- References:
- need help on this problem.
- From: Edward . Huerta
- need help on this problem.
- Prev by Date: Re: how to handle errors and preconditions
- Next by Date: Re: need help on this problem.
- Previous by thread: Re: need help on this problem.
- Next by thread: Re: need help on this problem.
- Index(es):
Relevant Pages
|