Mathematics × Programming Competition #7
Announcement of Answer and Winners
Announcement of Answer and Winners
For Chinese version please scroll to the bottom. 中文版請見文末。
Question
A point is chosen randomly in a square. 4 lines are drawn to connect this point with the 4 vertices of this square, such that 4 triangles are formed. Find the probability that all interior angles of the 4 triangles are less than 120°. Give your answer correct to the nearest 3 decimal places.
Answer: 0.213
Strictly speaking 0.21255 (not corrected to the nearest 3 decimal places) and 21.255 (missing % sign) are both incorrect answers, yet after consideration I decided to adopt a lenient approach and accept these answers as well.
Mathematical approach
Let’s assume the length of the square to be 1. The square is labelled as ABCD while the random point is called P as shown above.
Consider the locus formed by P such that ∠APD = 120°. This should be a circle because of converse of angles in the same segment. E is the center and ∠AED = 120° (angles at the centre is twice the angle at the circumference). If the random point falls in the shaded region, an interior angle will be larger than 120°, which violates the required criteria.
Combining the criteria produced from the 3 other sides of the square, we should be able to see that the required probability is the area of the center unshaded region divided by that of the whole square. Denote the area of the red and yellow shaded area as shown above as R and Y respectively. Then the required probability = 1 - 4Y + 4R.
Programming approach
We may carry out simulations for a large number of times and take the empirical probability as our answer. Note that we will never be able to obtain the exact answer in this approach, but this approach would work here since we were asked to give our answer correct to the nearest 3 decimal places only.
Psuedocode:
count = 0
Loop for 10,000,000 times
x = random(0 to 1)
y = random(0 to 1)
Use cosine theorem to check all 4 internal angles
If all angles < 120 then count++
End loop
Output count / 10,000,000
If time is allowed, the number of loops can be set to an even higher value so as to ensure accuracy.
Winners
Among 30 participants, there are 15 people who got the correct answers. Thank you for your participation!
@kona @philipheihei @guyverckw @leedslemon @armandocat @tvb @tensaix2j @wlcpu @galotta @livinguktaiwan @kangnajiang @geass @challk @mooninwater @superbing @kevingau @shieha @speeding @justyy @ghasemkiani @marziehshahabi @susankiani @ariak @megii @vincentyip @dkmathstats @akshaybornare @chasmic-cosm @rfece143 @dailyfortune
SBD payout of the the question post = 37.299 SBD
Besides, @steemstem has generously sponsored 7.5 SP, 5 SP and 2.5 SP for the first, second and third prizes!
The winners and prizes are tabulated below:
Winner | Prize | SBD |
---|---|---|
@leedslemon | First prize | 37.299 / 8 = 4.662 SBD + 7.5 SP |
@armandocat | Second prize | 37.299 / 8 = 4.662 SBD + 5 SP |
@tvb | Third prize | 37.299 / 8 = 4.662 SBD + 2.5 SP |
@tensaix2j | Consolation prize | 37.299 / 8 = 4.662 SBD |
@ghasemkiani | Consolation prize | 37.299 / 8 = 4.662 SBD |
@shieha | Consolation prize | 37.299 / 8 = 4.662 SBD |
@vincentyip | Consolation prize | 37.299 / 8 = 4.662 SBD |
@challk | Consolation prize | 37.299 / 8 = 4.662 SBD |
Congratulations to the winners!
The steemSTEM project (@steemstem) is a community-supported project aiming to increase the quality and the visibility of STEM (STEM is the acronym for Science, Technology, Engineering and Mathematics) articles on Steemit. Please support steemSTEM by following @steemstem and joining the chat channel. You can also consider joining a private curation trail to further support steemSTEM by asking about it in the chat channel. In order to further promote the use of the chat channel, I will stop announcing the time of next competition via a post. Instead I will announce the time in advance in the chat channel!
數學 × 程式編寫比賽 (第七回)
答案及得獎名單公佈
答案及得獎名單公佈
問題
在一個正方形內隨機選取一點,並將此點與四個頂點連上直線,從而將正方形分割為四個三角形。求四個三角形之中所有內角均不超過 120° 的概率,答案準確至小數點後 3 位。
答案: 0.213
按理0.21255 (不是準確至三個小數位) 及21.255 (沒有%符號) 均屬錯誤答案,經考慮下我決定採取寬鬆政策,一併接受此兩項答案。
數學方法
設正方形的長度為1,並標記為ABCD,而隨機點則稱為P,如上所示。
若固定∠APD= 120°,P形成的軌跡是一個圓(同弓形內的圓周角的逆定理)。E為圓的中心,可知∠AED= 120°(圓心角兩倍於圓周角)。 如果隨機點落在陰影區域,內角將大於120°,這違反了題目的要求。
結合正方形由其餘三面所產生的限制,我們可以知道題目所求的概率是中心非陰影區域的面積除以整個正方形的面積。 將紅色和黃色陰影區域的區域分別表示為 R 和 Y,那麼所需的概率 = 1 - 4 Y + 4 R。
編程方法
我們可以進行電腦模擬,在正方形內隨機抽出一點,並計算是否符合題目的要求,最後將實驗概率作為我們的答案。請注意,此方法並不能獲得確切答案,但此題目只要求將答案準確至最接近的3位小數位,因此當運行次數足夠大,答案正確的機會率將會相當高。
偽代碼:
count = 0
Loop for 10,000,000 times
x = random(0 to 1)
y = random(0 to 1)
Use cosine theorem to check all 4 internal angles
If all angles < 120 then count++
End loop
Output count / 10,000,000
如果時間充足,則可將迴圈次數設置為更高的值,以確保準確性。
得獎者
在30個參加者之中,有15人答對。多謝大家的熱烈參與!
@kona @philipheihei @guyverckw @leedslemon @armandocat @tvb @tensaix2j @wlcpu @galotta @livinguktaiwan @kangnajiang @geass @challk @mooninwater @superbing @kevingau @shieha @speeding @justyy @ghasemkiani @marziehshahabi @susankiani @ariak @megii @vincentyip @dkmathstats @akshaybornare @chasmic-cosm @rfece143 @dailyfortune
比賽題目帖文的SBD收入 = 37.299 SBD
另外,@steemstem 慷慨贊助了7.5 SP、5 SP以及2.5 SP予是次比賽的第一、二及三等獎!
下表顯示得獎者及其所得獎金:
得獎者 | 獎項 | SBD |
---|---|---|
@leedslemon | 一等獎 | 37.299 / 8 = 4.662 SBD + 7.5 SP |
@armandocat | 二等獎 | 37.299 / 8 = 4.662 SBD + 5 SP |
@tvb | 三等獎 | 37.299 / 8 = 4.662 SBD + 2.5 SP |
@tensaix2j | 安慰獎 | 37.299 / 8 = 4.662 SBD |
@ghasemkiani | 安慰獎 | 37.299 / 8 = 4.662 SBD |
@shieha | 安慰獎 | 37.299 / 8 = 4.662 SBD |
@vincentyip | 安慰獎 | 37.299 / 8 = 4.662 SBD |
@challk | 安慰獎 | 37.299 / 8 = 4.662 SBD |
恭喜所有得獎者!
steemSTEM(@steemstem)是一個由steemit社群支持的項目,旨在宣傳STEM(STEM是科學,技術,工程和數學的首字母縮略詞)。 請追蹤 @steemSTEM 以及加入聊天頻道來支持steemSTEM。你還可以透過加入自動點讚系統來在為了進一步支持steemSTEM,詳情請在聊天頻道內向負責人士查詢。為了推廣聊天頻道的使用,我將不再透過發文來宣布下一場比賽的時間,我會在聊天頻道中提前公佈比賽時間。
我又得奖啦,好幸运哟。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
恭喜啊 :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
你不会明天一早又出题了吧,我要不要订个闹钟?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
不會啦,最近比較忙,明天還要作那篇cn區接龍故事的文章,哈哈
可能再過幾天吧
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
你是第三个还是第四个,我也参加了哈哈哈,别理我,快睡吧。
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
我是第三呀,所以要明天寫,哈哈
我差不多睡了,晚安啦~
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
那你要抓紧了哈哈
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Great enjoy a lot want to see more of this in future. @kenchung
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
太感動了,居然第一了。計了一點點時間還以為只能試一下抽一下安慰獎呢!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
這應該說明了你低估了自己的實力啦😎
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
期待下一次中奖
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit