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

You are not logged in.
Post a replyTopic review (newest first)
Hi bobbym,
Hi gAr;
Hi bobbym, 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=:(((x1x2)^2)+(y1y2)^2)^%2 NB. The distances d2=:(((x1x3)^2)+(y1y3)^2)^%2 d3=:(((x3x2)^2)+(y3y2)^2)^%2 l1=:d1<0.618034 NB. Conditions to be met l2=:d2<0.76536686 l3=:d3<0.46689 (+/%#)(l1*.l2)*.l3 ≈0.027433
Hi;
This could be solved by using the built in functions that Mathematica supplies.
Hi;
The dist function can be improved. We can leave out the radical for faster execution.
Hi; Code:dist[{x1_,y1_},{x2_,y2_}]:=\[Sqrt]((x2x1)^2+(y2y1)^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.
Working with it a tiny bit you do not need the midpoint idea at all. There is an IntersectRegion command that might work better.
Hi;
Hello M:
Hi;
Sure. I just thought it was already somewhere on the forum.
I can post it, if you want it.
Where can I see the analytic answer, if one exists? 