Saturday 21 November 2015

The Horrible Maths for Three New Wrong Answers for Bertrand

If you don't like maths, don't read the stuff below.  It's only here to assist anyone thinking about where (and if) I made an error.

---

In Three New Wrong Answers for Bertrand, I talk about arriving at four numbers, 1/2, 3/4, something close to 4/9 and something close to 2/3.  What I don’t get into is the mathematics by which I arrived at this numbers.  I’ll do that here.

My analysis was done in Excel, using the rand() function.  I assumed a circle of radius 1 (y2 + x2 = 1), so I looked for a random point within a box defined by x=-1 and x=1 and y=0 and y=1 and a random point within a box defined by x=-1 and x=1 and y=0 and y=-1.

So x1=2*rand()-1, y1=rand(), x2=2*rand()-1 and y2=rand()*-1.

Then I determined the line defined by these two points, y=mx+c where m= (y2-y1/ (x2-x1) and c=y1-mx1= y2-mx2.

Then I looked for the points at where this line intersected the circle, which I did by inserting y=mx+c into y2 + x2 = 1 and solving for two values of x, x3 and x4 and using those to generate y3 and y4, from which I could determine the length of the chord and compare it to √3.

Just for completeness, after inserting y=mx+c into y2 + x2 = 1, I arrived at:

(m2+1)x2 + 2mcx + (c2-1) = 0 = αx2 + βx + γ

Which I solved using (-β ± √(β2 - 4αγ))/2α.


When I used two random pairs without limiting them to different halves, I checked against (β2 - 4αγ)>0 to ensure that the line intersected the circle.  If the pairs didn’t meet this criterion, I rejected them as not resulting in a chord.

For that effort, I used x1=2*rand()-1, y1=2*rand()-1, x2=2*rand()-1 and y2=2*rand()-1 to generate the two random pairs.

No comments:

Post a Comment

Feel free to comment, but play nicely!

Sadly, the unremitting attention of a spambot means you may have to verify your humanity.