# How can i calculate length of a rod with Monte Carlo method?

1. Dec 23, 2011

### cloudhunter

0_______._________________L
L/3
Suppose that there is a rod has length L. How can you calculate some part of its length from starting point (for example from 0 to L/3)?

2. Dec 23, 2011

### HallsofIvy

Staff Emeritus
I have no clue what you are asking. If you mean exactly what you say, then the length from "0 to L/3" is L/3, of course. Surely that's not what you mean!

3. Dec 23, 2011

### bigfooted

I think you have simplified your question too much. It is possible for instance to obtain the surface area enclosed by a circle with a Monte Carlo method.

Take a square of sides one with the middle at (0,0) and generate two uniform random numbers (x,y) between -0.5 and 0.5. If (x*x + y*y)<1 then the point is inside the circle of radius 1. Do this 10,000 times. The ratio of points inside and outside is the surface area enclosed by the circle. Hope this helps, else please reformulate your question.

4. Dec 24, 2011

### cloudhunter

HallsofIvy -I mean finding the length of any part of a rod. It can be L/3 or L/4. Yes, 0 to L/3 is L/3. Sorry for my English...
bigfooted - Thank you. Your way is similar to Pi calculation examples with this method; but is this the only way ? I think, if you draw i can understand better. I couldn't calculate like you said. Can you e-mail me? (cloudhunteer@hotmail.com)

5. Dec 24, 2011

### HallsofIvy

Staff Emeritus
Okay, choose a number, N, of points "at random" from the line segment. Let m be the number of those points that are inside your interval. If the line segment has length L then the segment has length (m/N)L.

6. Dec 24, 2011

### cloudhunter

Ok... Thank you. Thank you.. Thank you... :)