Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

|
Options

gAr
2013-09-03 18:36:49

Hi bobbym,

Thanks for the idea

bobbym
2013-09-03 18:05:18

Hi gAr;

She came to the same conclusion. Very good work!

gAr
2013-09-03 15:45:11

Hi bobbym,

This can also be done without calculating the midpoints. We can consider the sample angle itself as the angle of the midpoint, and then calculate the distance.

The threshold of the distances are sqrt(2*(1-cos 27)), sqrt(2*(1-cos 36)) and sqrt(2*(1-cos 45))

J simulation:

#### Code:

```load 'trig'
samp =: 1000000
a1=:(?samp\$360)*1p1%180           NB. The angles
a2=:(?samp\$360)*1p1%180
a3=:(?samp\$360)*1p1%180
x1=:cos a1                        NB. The points
y1=:sin a1
x2=:cos a2
y2=:sin a2
x3=:cos a3
y3=:sin a3
d1=:(((x1-x2)^2)+(y1-y2)^2)^%2    NB. The distances
d2=:(((x1-x3)^2)+(y1-y3)^2)^%2
d3=:(((x3-x2)^2)+(y3-y2)^2)^%2
l1=:d1<0.618034                   NB. Conditions to be met
l2=:d2<0.76536686
l3=:d3<0.46689
(+/%#)(l1*.l2)*.l3```

≈0.027433

Time taken for execution is about 0.758 seconds.

bobbym
2013-09-02 21:53:11

Hi;

I have been playing with that all night. So far, I have not done it. Perhaps you will?

ElainaVW
2013-09-02 21:51:18

This could be solved by using the built in functions that Mathematica supplies.

bobbym
2013-09-02 21:49:45

Hi;

Yes, it was the only way that could work in both programs. M does not have an IntersectRegion command.

ElainaVW
2013-09-02 21:47:43

The dist function can be improved. We can leave out the radical for faster execution.
It might be compilable. I see why you stuck with the midpoint idea for both.

bobbym
2013-09-02 21:42:16

Hi;

I discovered that too after I had posted the program. It does appear to be a substantial improvement.

Here is the code you requested:

#### Code:

```dist[{x1_,y1_},{x2_,y2_}]:=\[Sqrt]((x2-x1)^2+(y2-y1)^2);

midpoint[{{x1_,y1_},{x2_,y2_}}]:={(x1+x2)/2,(y1+y2)/2};

sectormid[arcangle_] := Module[{a = RandomInteger[{0, 360}]},
arc1 = {{Cos[Degree*a], Sin[Degree*a]}, {Cos[Degree*(a + arcangle)],
Sin[Degree*(a + arcangle)]}} // N;
midpoint[arc1]];

ans=Table[{sectormid[18],sectormid[36],sectormid[54]},{100000}];
s1=Select[ans,dist[First[#],#[[2]]]<=0.45399&];
s2=Select[s1,dist[First[#],#[[3]]]<=0.58779&];
s3=Select[s2,dist[#[[2]],#[[3]]]<=0.69466&];Length[s3]/100000.```

As you can see there is much chance for improvement. It will run faster on your machines than mine too.

ElainaVW
2013-09-02 21:30:34

Working with it a tiny bit you do not need the midpoint idea at all. There is an IntersectRegion command that might work better.

bobbym
2013-09-02 14:24:07

Hi;

Polar was a last resort, after more than a week of fumbling with those vectors, I finally gave up. Anyways, they have the same problem the sector command does. It was difficult to tell when there was a triple intersection. In the end the polygon - polar idea with the distance between the midpoints that finally worked. The M code is on the way.

ElainaVW
2013-09-02 14:17:14

Hello M:

Thanks for all the work. Why did you choose polar coordinates and not vectors or the Sector command for the sectors? Can you post the Mathematica code when you get a chance?

bobbym
2013-09-02 00:36:01

Hi;

#### Daniel C wrote:

The probability two sectors with central angles α and β intersect is (α+β) / (2π).

This can easily be proven with a diagram. The second sector can be right to the left or right of the first, or anywhere in between. This results in an angle of α+β.

Now, to the problem. Fix the sector with central angle π/10, and call it A. Consider the sector with central angle 2π/10, and call it B. The third sector is C. The probability B intersects A is 3/20, by the fact above.

Now, let f be the function that models the intersection of A and B for each position. Since area is linearly dependent on angle, f first rises, stays constant, and then falls (draw it yourself; draw a circle, a sector, and see where the second sector can intersect the first). The graph looks like a hill.

Either way, the point is that the expected value for the area of the intersection is π/15. Now, by our fact above, the probability that C intersects our current intersection is 11/60. Once again, this is valid because area is linearly dependent on angle.

Our probability is, multiplying our two probabilities:
3/20⋅11/60=11/400

anonimnystefy
2013-09-02 00:19:00

Sure. I just thought it was already somewhere on the forum.

bobbym
2013-09-02 00:14:13

I can post it, if you want it.

anonimnystefy
2013-09-01 21:47:35

Where can I see the analytic answer, if one exists?

Also, I must try this one. Looks cool.