Return to JUNTO
JUNTO Practice: Probability, Circle Arcs
Discussed on June 30, 2020.
From "Twenty problems in probability":
Choose, at random, three points on the circle x2 + y2 = 1. Interpret them as cuts that divide the circle into three arcs. Compute the expected length of the arc that contains the point (1, 0).
Please provide an answer and a justification.
Click to see:
import numpy as np def random_theta(): return 360 * np.random.sample() def get_x_y(theta, r=1): return r * np.cos(theta), r * np.sin(theta), theta def get_arc_lengths(): points = [get_x_y(random_theta()) for _ in range(3)] lengths = sorted([p for p in points]) length_w_point = lengths + (360 - lengths[-1]) return length_w_point np.mean([get_arc_lengths() for _ in range(1000000)])
Initially I naively assumed that (1,0) was just a random point, and so I assumed the expected value f the arc containing it was just the expected value of the length of any arc (120 degrees or 2pi/3).
I realized after reviewing John's solution and the answer in the document that this was an oversimplification. I instead simulated, the last and first point around the 360 degrees of the circle and calculated the mean. The mean was 180 degrees, or roughly pi in radians.
I believe that the expected length of the arc that contains (1, 0) is π.
I wrote a Python function to sample the random variable "the length of the arc that contains (1, 0)":
import math, random, statistics def n_random_arc_length(*, n): """Sample the random variable 'length of the arc containing (1, 0)' `n` times. """ rand = random.random tau = math.tau arcs = [None] * n for i in range(n): points = [rand() * tau, rand() * tau, rand() * tau] points.sort() arcs[i] = points + (tau - points[-1]) return arcs statistics.mean(n_random_arc_length(n=10_000_000))
This seems suspiciously close to π, and given that this problem takes place on a circle, this makes me believe that the expected value is π.
The answer is approximately 'pi' as per the five simulation findings below:
from random import random import math from statistics import mean def simulate(n): # create empty list for desire arc lengths l = [0 for i in range(n)] i = 0 s = len(l) while i < s: # create three random points along the circle theta = random() * (2 * math.pi) alpha = random() * (2 * math.pi) gamma = random() * (2 * math.pi) cartesian = [theta, alpha, gamma] # order the values in a copied list from smallest to # largest so that we may 'measure' the arc length # around our desired coordinate which is in between # the smallest and largest cartesian coordinate pair # (1, 0) ordered = sorted(cartesian) largest_coordinate = ordered middle_coordinate = ordered smallest_coordinate = ordered # populate the arc length list with values passing # through desired point l[i] = ( smallest_coordinate + middle_coordinat + largest_coordinate ) - (2 * math.pi) i += 1 return l # print the mean of the total simulated values from # arclength list print(mean(simulate(1000000)))