Three points are randomly selected inside a sphere.
What is the probability that the three points form an acute angled triangle?
The below is wrong.It solves for a circle instead of a sphere.
A simulation was done assuming every point had equal probability of being selected. Uniformly distributed x and y coordinates within a double-unit cube centered on the origin were selected. Any point not within 1 unit of the origin was rejected and replaced.
Ten million trials were done within which 27.94% resulted in acute triangles. The cumulative results at reaching each milestone of an even million are shown:
acute obtuse total fraction acute
79576 720424 1000000 0.279576
558760 1441240 2000000 0.27938
837860 2162140 3000000 0.279286666666667
1117663 2882337 4000000 0.27941575
1397475 3602525 5000000 0.279495
1676420 4323580 6000000 0.279403333333333
1955536 5044464 7000000 0.279362285714286
2235472 5764528 8000000 0.279434
2515604 6484396 9000000 0.279511555555556
2794364 7205636 10000000 0.2794364
The program tests for obtuseness by comparing the square of the largest side to the sum of the squares of the other two sides.
DefDbl A-Z
Dim crlf$
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For tr0 = 1 To 1000
Randomize Timer
trct = 0
Do
DoEvents
x1 = rpt(): y1 = rpt()
x2 = rpt(): y2 = rpt()
X3 = rpt(): Y3 = rpt()
If dist(x1, y1, 0, 0) < 1 Then
If dist(x2, y2, 0, 0) < 1 Then
If dist(X3, Y3, 0, 0) < 1 Then
trct = trct + 1
d1 = dist(x1, y1, x2, y2)
d2 = dist(X3, Y3, x2, y2)
d3 = dist(x1, y1, X3, Y3)
dmx = d1
If d2 > d1 Then dmx = d2
If d3 > dmx Then dmx = d3
tsq = d1 * d1 + d2 * d2 + d3 * d3 - dmx * dmx
If dmx * dmx > tsq Then obtct = obtct + 1
If dmx * dmx < tsq Then acutect = acutect + 1
End If
End If
End If
Loop Until trct >= 10000
If tr0 Mod 100 = 0 Then
Text1.Text = Text1.Text & acutect & Str(obtct) & " "
Text1.Text = Text1.Text & acutect + obtct & " "
Text1.Text = Text1.Text & acutect / (acutect + obtct) & crlf
End If
Next tr0
Text1.Text = Text1.Text & crlf & " done"
End Sub
Function rpt()
rpt = 2 * Rnd(1) - 1
End Function
Function dist(x1, y1, x2, y2)
xdiff = x1 - x2: ydiff = y1 - y2
dist = Sqr(xdiff * xdiff + ydiff * ydiff)
End Function
Edited on December 25, 2018, 1:21 pm
|
Posted by Charlie
on 2018-12-21 10:58:56 |