A clock has an hour, minute, and second hand, all of length 1. Let T be the triangle formed by the ends of these hands. A time of day is chosen uniformly at random. What is the expected value of the area of T?
(In reply to
re(2): Computer method - faulty premise by Larry)
I reworked the code; I have not debugged so I can't rule out a math error but I wanted to get this out quickly.
This time I get: 0.480962582520713
I checked the position of the 3 hands once per second for 12 hours. Even though the clock hands start vertical and rotate clockwise, I used the usual custom for cos and sin assuming the hands all start horizontal and rotate counterclockwise. This should just be a rotated mirror image of the actual clock.
---------
import math
pi = math.pi
def area(a,b,c):
""" Assume a,b,c are angles in radians, and
the 3 vertices of a triangle are at (cos a, sin a),
(cos b, sin b) and (cos c, sin c)
return the area """
x = [math.cos(a), math.cos(b), math.cos(c),math.cos(a)]
y = [math.sin(a), math.sin(b), math.sin(c),math.sin(a)]
d = []
for i in range(3):
d.append( ( (x[i+1]-x[i])**2 + (y[i+1]-y[i])**2 )**.5 )
semip = sum(d)/2
terms = [ max(semip-d[i],0) for i in range(3)]
ans = ( (semip-d[0])*(semip-d[1])*(semip-d[2])*semip )**.5
ans = ( terms[0] * terms[1] * terms[2] * semip )**.5
return ans
count = 0
total = 0
for sec in range(43200):
second_hand = sec%60 * pi / 30
minute_hand = (sec/60)%60 * pi / 30
hour_hand = (sec/3600)%60 * pi / 30
count += 1
total += area( second_hand, minute_hand, hour_hand )
print(total/count)
|
Posted by Larry
on 2023-08-23 13:49:57 |