4

I'm trying to calculate a total score for a decathlon participant and there are two formulas given, one is for a field events and the other is for track events.

Points = INT(A(B — P)^C) for track events (faster time produces a better score)

Points = INT(A(P — B)^C) for field events (greater distance or height produces a better score

A, B and C are given constants for this formulas and P is the athletes performance measured in seconds (running), metres (throwing), or centimetres (jumping).

Once I am trying to calculate I get a result that is a complex number that I cannot convert into integer or smth like that.

These are the constants for A,B and C : https://en.wikipedia.org/wiki/Decathlon#Points_system

These are my values for athlete's performance (a list that I will try somehow, after adding the total score, convert into a JSON file):

splited_info = ['Lehi Poghos', '13.04', '4.53', '7.79', '1.55', '64.72', '18.74', '24.20', '2.40', '28.20', '6.50.76']

Could someone give me some feedback on what or how am I doing this wrong?

def split(info):
    with open(info.filename, "r") as f:
        csv_reader = csv.reader(f, delimiter="\n")
        for line in csv_reader:
            splited_info = line[0].split(";")
            score = 0
            score += int(25.4347 * ((18 - float(splited_info[1])) ** 1.81))
            score += int(0.14354 * ((float(splited_info[2]) - 220) ** 1.4))
            score += int(51.39 * ((float(splited_info[3]) - 1.5) ** 1.05))
            score += int(0.8465 * ((float(splited_info[4]) - 75) ** 1.42))
            score += int(1.53775 * ((82 - float(splited_info[5])) ** 1.81))
            score += int(5.74352 * ((28.5 - float(splited_info[6])) ** 1.92))
            score += int(12.91 * ((float(splited_info[7]) - 4) ** 1.1))
            score += int(0.2797 * ((float(splited_info[8]) - 100) ** 1.35))
            score += int(10.14 * ((float(splited_info[9]) - 7) ** 1.08))
            score += int(0.03768 * ((480 - float(splited_info[10])) ** 1.85))
            print(score)

I'm just hardcoding all the calculations since all the calculations are going to be different with all different values of A,B,C and P.

9
  • So on which athlete does it return complex numbers? By the way, float(splited_info[10]) should immediately throw an exception because '6.51.01' is not a valid number. Commented Jun 3, 2018 at 11:54
  • well the first calculation goes okay, but the second one : score += int(0.14354 * ((float(splited_info[2]) - 220) ** 1.4)) gives me a TypeError that it cannot convert complex to int. Ah yes, I will have to modify the last calculation , thanks for noticing :) Commented Jun 3, 2018 at 12:00
  • 3
    @YakymPirozhenko Complex numbers are not “complicated”, but a specific set of numbers in maths. OP somehow gets (4.53 - 220) ** 1.4 == (-571.1154387048516-1757.7125835285435j), which is weird. Commented Jun 3, 2018 at 12:03
  • 1
    @Norrius I was (wrongly) assuming that OP misused the term. (4.53 - 220) ** 1.4 being complex makes perfect sense because (-1)**1.4 == (-1) ** (7/5) is a root of unity. Commented Jun 3, 2018 at 12:12
  • 1
    Are you sure your data is in the correct order? (Long Jump second?) Commented Jun 3, 2018 at 12:26

1 Answer 1

1

The problem is a mix up of metres and centimetres. The Wikipedia page is slightly inaccurate in its recount of the formulae - throws are measured in metres but jumps should be measured in centimetres. This is why you're getting fractional powers of negative numbers.

See the original source for more info:

enter image description here

  • IAAF Scoring Tables for Combined Events, p. 24.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.