تم الحل ✓
categoryالرياضيات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
1. A simple serial 'for loop' approach (10%)
Using the algorithm given in the instructions, write a serial for-loop approach to plot a graph of probability vs. number of people. Note: faste
implementations are of course possible using MATLAB array syntax, but we are interested in examining principles of parallelisation so pleas
implement the algorithm as provided.
% Write your code here:
Questions
Exercise 2 - 50% of the mark
This task is a variant of the well documented 'birthday paradox' problem - you are required to calculate the probability of exactly two people (and only
two people) sharing a birthday on any day.
To do this,
1.
For a given number of people (we shall refer to this number as N)
2.
Calculate N random numbers in the range 1-365 (we will ignore leap years).
If two (and only two) of the numbers are the same, we consider our criteria has been met and add one to a counter C.
Repeat (2) & (3) a sufficiently large number of times (R) to get a statistically valid answer
3.
4.
5.
The probability is calculated as P(N) = (C/R) 100
The above steps to be done for a range of N from 2 to 200 (inclusive), a graph of N vs P(N) is then to be plotted
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.