I'm trying to write an algorithm for calculating percentages for an amount of goals of a football match. I'm a programmer, but Stackoverflow doesn't like math things, so I came here.
How does it look like: We have 5 'chances' for 1 goal, 2 goals, 3, 4, and 5 goals. Each 'chance' has to be lower from previous (chance for 2 goals < chance for 1 goal in a match). And we need to fit in 100% with all 5 values.
First, I ask my user to provide a chance for 'one goal'. I did some calculations and it seems, that the 'one goal' chance has to be in a range 22-90, because: if we get 21, our next value must be lower so: 20, 19, 18, 17 which gives: 21+20+19+18+17 = 95 which is not 100% (we need 100% for all goals) So we need to start from 18 and end on 22, cause these are first numbers which sum gives 100.
Same situation is for end of the range. It must be maximum 90. If we pick 90 for first goal, we can only pick 4, 3, 2, 1, cause it will give 100. If we would pick 91, we go out of range (100).
I don't know how to write a function which will change these 'max' and 'min' values while providing next 'chance'. I have totally no clue, sitting here for 2 hours and drawing some linear functions.