Hi Folks, I need to calculate the number of possible ratios for the following R=1- (P1*S2/P2*S1) where P1,P2,S1,S2 are integers between 20 and 70? Some one came up with a figure of 51*51*51*51 possible ratios but I don't know how this was determined. What branch of Math does this generally fall under...arithmetic sequences? thanks
I wouldn't know the proper name either but I would venture to say something along the line of Combinatorial Theory?...that sounds fancy...anyway just Combination/Permutation stuff. Think decimal system, for example, you have two variables P and S and they can take values from 0 to 9...how many different combinations PS can you make? Answer: 00, 01, 02...99; that's going to be a total of 100 or 10x10 (10 for the amount of values each variable can take). get it? The same for your case, you just need to count the number of all possible values to each variable to find out the total number of permutations. ...but this is not going to be the total number of ratios of interest to you, since the variables can take on similar values and because 3x5 = 5x3, etc, there will be many instances where your permutations will have the exact same value...so, your total will be less than 51*51*51*51 Hope this helps.
Yes it is combinatorics - the site already linked to is the best introduction to this subject on the web IMHO. 51^{4} has been generated simply by noting that there are 51 integers in the range [20, 70], so for each 51 choices of P1 there are 51 choices of S1 making 51^{2} possibilities, and for each of these there are 51 choices of P2 etc. However this ignores the fact that choices for (P1, S1, P2, S2) such as (a, b, c, d) and (b, a, d, c) will give equal ratios, as will for example (20, 20, 20, 20) and (40, 40, 40, 40). The first one of these can be fairly easily catered for*, but I can't see any way around the second other than enumerating each of the possibilities and calculating them (well I suppose you could look at which integers had common factors and treat them carefully, but this would be a lot harder to program correctly and the computation time even for 1.8 million combinations is insignificant). * there are 51^{2} possibilities for (P1, S1) and for (P2, S2) but we can reduce each of these to (51^{2} +51) / 2 to allow for the swapping P1 and S1 or P2 and S2. The total number of possibilities are therefore reduced to (51^{2} + 51)^{2} / 4 ≈ 1.8x10^{6}.
Thanks guys, Not sure I follow the * description. Could you elaborate a little further..? When you say the first one, are you referring to (20,20,20,20)? I guess this going to be tricky to implement in excel...! cheers
Sorry, (20, 20, 20, 20) was a terrible example, let me try again to make it a bit clearer: ... However out of the 51^{4} possible permutations, many of them will give equal ratios. Consider P1=a, S1=b, P2=c, S2=d (from now on I will write this as (a, b, c, d). This gives the ratio ad/bc, but exactly the same ratio is given by (d, c, b, a), (d, b, c, a) and (a, c, b, d). It is tempting to think that we can simply divide 51^{4} by 4 but this will not treat the situation when a=d or b=d correctly. What we actually want is the number of combinations (a, d): this is given by (51^{2}+51)/2. So the total number of ratios with distinct numerators and denominators wil be taking all (51^{2}+51)/2 possible numerators with all (51^{2}+51)/2 possible denominators. This will give approximately 1.8x10^{6} possibilities. There is a further category of duplicated ratios, for example (20, 21, 22, 23) and (40, 42, 44, 46) but I can't see any easy way to eliminate these other than enumerating each of the possibilities and calculating them (well I suppose you could look at which integers had common factors and treat them carefully, but this would be a lot harder to program correctly and the computation time even for 1.8 million combinations is insignificant). Note that the current version of Excel has just over 10^{6} rows per sheet so it might be possible to enumerate these over 2 sheets, but I have no idea whether that is feasible from a memory/recalc time point of view.
1) That makes things a little clearer although I am still not sure how you arrived at (51^2+51)/2? 2) So there is no easy way of deriving a neat expression that determines all ratios without duplicates in Combination/Permutation Theory? 3)Also on a slight tangent. For the simpler case of 1-S1/P1 for each variable between 20 and 70. This would mean 51^2. But what in the case where P1 varies from 20 to 70 and S1 from 20 to 30. We would get 51*(11)=561...right? I would like to write this using the nth power. So to find the required power to base 51 we take logs...ie 51^n=561 implies n=1.6099. But its difficult to get exactly 561 with this method right? thanks