The Women's Olympic Heptathlon is comprised of seven events in which competitors are awarded points based on their performance. The points are awarded according to the following formulas for the different groups of events (running, jumping, throwing). The formulas are devised to award 1000 points for some reference performance and 0 points at some minimum level of performance.
Running: $P = a(b-T)^c$ (time, $T$ in seconds)
Jumping: $P = a(H-b)^c$ (height, $H$ in cm)
Throwing: $P = a(D-b)^c$ (distance, $D$ in m)
The coefficients for these formulas are given for each event in the table below.
Event | $a$ | $b$ | $c$ |
---|---|---|---|
100 m hurdles | 9.23076 | 26.7 | 1.835 |
High jump | 1.84523 | 75 | 1.348 |
Shot put | 56.0211 | 1.50 | 1.05 |
200 m | 4.99087 | 42.5 | 1.81 |
Long jump | 0.188807 | 210 | 1.41 |
Javelin throw | 15.9803 | 3.80 | 1.04 |
800 m | 0.11193 | 254 | 1.88 |
At the 2016 Rio Olympics the competitors awarded medals performed as given in this table.
Event | Nafissatou Thiam | Jessica Ennis-Hill | Brianne Theisen Eaton |
---|---|---|---|
100 m hurdles | 13.56 s | 12.84 s | 13.18 s |
High jump | 1.98 m | 1.89 m | 1.86 m |
Shot put | 14.91 m | 13.86 m | 13.45 m |
200 m | 25.10 s | 23.49 s | 24.18 s |
Long jump | 6.58 m | 6.34 m | 6.48 m |
Javelin throw | 53.13 m | 46.06 m | 47.36 m |
800 m | 2 min 16.54 sec | 2 min 9.07 sec | 2 min 9.50 sec |
Write a Python program to store the coefficients in a dictionary, keyed by the event name, and use another dictionary to store the competitors' results in each event. Use these data structures. Define functions to calculate the points a given performance is awarded in each event, and use them to calculate the total number of points for each of the competitors.
Bonus exercise: Generate the following diagram as an SVG image.
Hints: the following function returns a point on the unit circle a fraction i/n
of the way round from a reference direction defined by phase
(use phase=0
to use the $x$-axis as this refefence direction).
def get_point_on_unit_circle(i, n, phase=0):
return np.cos(2*np.pi*i/n - phase), np.sin(2*np.pi*i/n - phase)
Find the distances along each event axis in pixel coordinates with:
r_pts = r * (event_points - min_points) / (max_points - min_points)
where min_points
and max_points
correspond to the centre and outer limit of the chart axes respectively (500 and 1300 are good choices here) and r
is the radius of the chart in pixels.
This figure was inspired by @kala_blanc's visualization on Twitter.
To access solutions, please obtain an access code from Cambridge University Press at the Lecturer Resources page for my book (registration required) and then sign up to scipython.com providing this code.