2

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.

  • To get people interested in assisting you it is a good idea to include some code you have tried. Also, there are infinitely many probability distributions after $\mathbb{P}(x_{1})=a$ for $0<a<1$ and $\Omega = {x_{i}} ; i \in {1, ..., 5}$. –  Dec 21 '15 at 21:18
  • Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Dec 21 '15 at 21:20
  • This question belongs on StackExchange.CrossValidated, certainly not here. – David G. Stork Dec 21 '15 at 21:32
  • The question seems to be about doing the calculations to present the user with a range of permissible values based on his previous entries. Its straightforward, but show some (mathematica) code so we know where the problem lies. – george Dec 21 '15 at 22:17

1 Answers1

2

You can play with

sel = Select[IntegerPartitions[100, {5}], Length@Union@# == 5 &];

This list is very long

Length@sel

25337

The first distribution yields

sel[[1]]

{90, 4, 3, 2, 1}

and the last one

sel[[-1]]

{22, 21, 20, 19, 18}

Taking every 1000th element:

sel[[;; ;; 1000]]

{{90, 4, 3, 2, 1}, {67, 20, 7, 5, 1}, {62, 20, 10, 7, 1}, {59, 16, 12,9, 4}, {56, 21, 12, 8, 3}, {54, 19, 13, 12, 2}, {52, 21, 14, 7, 6}, {50, 26, 16, 7, 1}, {49, 19, 14, 10, 8}, {47, 30, 13, 6, 4}, {46, 25, 22, 5, 2}, {45, 23, 17, 8, 7}, {44, 21, 17, 16, 2}, {43, 19, 18, 12, 8}, {41, 40, 16, 2, 1}, {40, 39, 12, 7, 2}, {39, 38, 16, 6, 1}, {39, 18, 17, 15, 11}, {38, 20, 15, 14, 13}, {37, 19, 18, 14, 12}, {35, 34, 19, 11, 1}, {34, 32, 21, 12, 1}, {33, 30, 18, 11, 8}, {32, 26, 22, 19, 1}, {30, 28, 17, 15, 10}, {27, 26, 22, 16, 9}}

eldo
  • 121
  • 1
  • 2