Bertrand's paradox java simulation

Tags:  •    •    •    •  

I found an interest math problem Bertrand's paradox. This problem was originally posed by Joseph Bertrand in his work.

The Problem

Determine the probability that a random chord of a circle of unit radius has a length greater than the square root of 3, the side of an inscribed equilateral triangle.

Experiment simulation

I've modeled this problem with 3 java classes (Circle, Point, Main). The Main class does the experiment with other 2 classes. The main problem in this paradox is the random chord definition. What do we mean under random chord? I try to implement the problem in the way that I select both chords of circle object randomly.

My algorithm for generating 2 random chord

(we have a circle)

  1. Select a random coord (x,y) anywhere (2 random real numbers)
  2. This define a direction vector. Scale it to radius length.
  3. Shift this chord, if the center of circle is not (0,0).
  4. Now the first chord is done.
  5. Repeat 1-3. steps for generate second chord of circle.
  6. Evaluate two point distance and compare it with the side of triangle.

You can set the number of experiments a command line parameter.

My result

My result was 33.33% or 1/3. I've executed this simulation for 10,000,000 experiments. The result was 33.333%. You can try it also and view the source and I welcome any comment for this post.

Download

You can download the experiment simulation program. Feel free to edit, copy or distribute the code. The .zip file is included the sources (Circle.java, Point.java, Main.java) and the executable .jar version:
bertrand_paradox.zip [6.89 KB]

This program is a

This program is a programming example rather than a mathematical issue.

Submitted by R2D2 (not verified) on June 16, 2009 - 7:57pm.
blunders on bertrand's paradox

Hi,

on www.cut-the-knot.com site you can find three or more program simulations that leads to three different solutions or more. Problem can't be solved with programming if the program involves wrong preassumption. So the problem is where is the blunder. My explanations you can check on http://www.bertrands-paradox.com and on one earlier http://user.sezampro.yu/~seik/Bertrands%20paradox.htm . Yes, correct answer is 1/3!

regards
Bozur

Submitted by Visitor (not verified) on May 9, 2008 - 4:00pm.
Yes, this correct

This program is a programming example rather than a mathematical issue. This is an example, how to find answer with an alternative (not mathematical) way for this issue. The answer is correct. I heard this issue in probability lesson in the previous semester. A find the answer with this experiment, what is not a proof unfortunately. This experiment don't think about other solutions. This program is find solution for this paradox like for any other "normal" mathematical issue.

Thank you your comment.

Submitted by Thomas on May 17, 2008 - 10:31pm.

Post new comment

The content of this field is kept private and will not be shown publicly.