6 ms·
I came up with a third -- it seemed fairly obvious after some thought. I do not quite get the 1/2 and 1/4 explanations. (Unfortunately these gif analogies do no
by transfire 11y ago
I came up with a third -- it seemed fairly obvious after some thought. I do not quite get the 1/2 and 1/4 explanations. (Unfortunately these gif analogies do not do such a great job of clarifying.) So I decided to ask good old "Reality".
N = 1000
SQRT3 = Math.sqrt(3).to_r
def point_on_circle
x = (rand().to_r * 2) - 1
y = Math.sqrt(1 - x**2)
y = -y if rand(2) == 0
return [x,y]
end
tally = 0
N.times do
x1, y1 = point_on_circle
x2, y2 = point_on_circle
d = Math.sqrt( (x2 - x1)**2 + (y2 - y1)**2 )
tally += 1 if d > SQRT3
end
puts "#{tally}/#{N}"
Oddly, it gives an answer close to a third (yeah me!). But... it is always a bit high at approx 36%.
- x3n0ph3n3 11y agoThat's because you used "random endpoints" chord selection (which has the probability of 1/3). Now try it with the "random radius" and "random midpoint" methods described here: https://en.wikipedia.org/wiki/Bertrand_paradox_%28probability%29#Bertrand.27s_formulation_of_the_problem https://en.wikipedia.org/wiki/Bertrand_paradox_%28probabilit... It's probably not wise to assume that you just easily solved a 100+ year old unsolved mathematical problem.
- personjerry 11y agoWhy do they say "unsolved" if the classical solution seems to deal with the "paradox"?
- x3n0ph3n3 11y agoWe have conjectures and approaches but no proven solution.
- antimagic 11y agoI'm thinking though that if you talk a fairly large area surrounding a circle, and then randomly selected two points within it. Draw a line between the two points. If the line intersects the circle, calculate the length the length of it's chord. Bigger then sqrt(3) or less get put into bins, and the probability is calculated from there. Obviously this would work better if the area was an infinite plane, but I would expect to see the answer tending to a value as the size of the area increased. I don't believe that this approach makes any assumptions about the chords that it generates. Here's a ruby snippet that does just that (err, I think!) plane_size = 10000.0 chords = [] while chords.size < 100 p1 = {} p2 = {} p1[:x] = Random.rand(plane_size) - plane_size / 2 p1[:y] = Random.rand(plane_size) - plane_size / 2 p2[:x] = Random.rand(plane_size) - plane_size / 2 p2[:y] = Random.rand(plane_size) - plane_size / 2 puts p1 puts p2 #gradient 'm' m = (p2[:y] - p1[:y]) / (p2[:x] - p1[:x]) #y = mx + b # => b = y - mx b = p2[:y] - m * p2[:x] #x^2 + y^2 = 1 #sub in y from the line equation #x^2 + (mx + b) * (mx + b) = 1 #x^2 + m^2x^2 + 2bmx + b^2 = 1 #x^2(1 + m^2) + 2bmx + b^2 - 1 = 0 #apply the quadratic equation to find the roots #Ax^2 + Bx + C = 0 #=>x = (-B +- sqrt(b^2 - 4AC)) / 2A #in our case, A = (1 + m^2), B = 2bm, C = b^2 -1 #the line intersects if B^2 -4AC > 0 discriminator = (2 * b * m) * (2 * b * m) - 4 * (1 + m * m) * (b * b - 1) if discriminator > 0 then chord1 = {} chord2 = {} chord1[:x] = (-2 * b * m + Math.sqrt(discriminator) ) / (2 * (1 + m * m)) chord1[:y] = m * chord1[:x] + b chord2[:x] = (-2 * b * m - Math.sqrt(discriminator) ) / (2 * (1 + m * m)) chord2[:y] = m * chord2[:x] + b length = Math.sqrt((chord2[:x] - chord1[:x]) * (chord2[:x] - chord1[:x]) + (chord2[:y] - chord1[:y]) * (chord2[:y] - chord1[:y])) chords << length end end smaller = 0 chords.each {|c| smaller += 1 if c < Math.sqrt(3) } puts "The number of chords smaller than sqrt(3) = #{smaller/100.0}%" If I believe the result, the real world seems to feel that the answer is 0.5 Edit: Hah! Should have read just a few comments further, and I would have seen some other posts doing exactly the same thing. Good to see we ended up with the same answer :D
- chadzawistowski 11y agoYour answer will follow from the chosen "random" sampling method. Since the sampling method is not stated as part of the problem, there is ambiguity. For this Ruby snippet, you chose random (x,y) coordinate pairs on a plane. This corresponds to selection method #2 as outlined on the Wikipedia article [0]. Scroll down a bit to see different selection methods visualized! [0] https://en.wikipedia.org/wiki/Bertrand_paradox_%28probability%29#Bertrand.27s_formulation_of_the_problem https://en.wikipedia.org/wiki/Bertrand_paradox_%28probabilit...
- reilly3000 11y ago36.111% is the average of the 3 provable answers. Maybe the universe takes the average of all probabilities to produce a resultant probability.