Calculate possible ratios

by bugatti79
Tags: ratios
 P: 660 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
 P: 876 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.
 P: 500 Yes it is combinatorics - the site already linked to is the best introduction to this subject on the web IMHO. 514 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 512 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 512 possibilities for (P1, S1) and for (P2, S2) but we can reduce each of these to (512 +51) / 2 to allow for the swapping P1 and S1 or P2 and S2. The total number of possibilities are therefore reduced to (512 + 51)2 / 4 ≈ 1.8x106.
P: 660
Calculate possible ratios

 Quote by MrAnchovy Yes it is combinatorics - the site already linked to is the best introduction to this subject on the web IMHO. 514 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 512 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 512 possibilities for (P1, S1) and for (P2, S2) but we can reduce each of these to (512 +51) / 2 to allow for the swapping P1 and S1 or P2 and S2. The total number of possibilities are therefore reduced to (512 + 51)2 / 4 ≈ 1.8x106.
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
 P: 500 Sorry, (20, 20, 20, 20) was a terrible example, let me try again to make it a bit clearer: ... However out of the 514 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 514 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 (512+51)/2. So the total number of ratios with distinct numerators and denominators wil be taking all (512+51)/2 possible numerators with all (512+51)/2 possible denominators. This will give approximately 1.8x106 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 106 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.
P: 660
 Quote by MrAnchovy Sorry, (20, 20, 20, 20) was a terrible example, let me try again to make it a bit clearer: ... However out of the 514 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 514 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 (512+51)/2. So the total number of ratios with distinct numerators and denominators wil be taking all (512+51)/2 possible numerators with all (512+51)/2 possible denominators. This will give approximately 1.8x106 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 106 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

 Related Discussions Biology, Chemistry & Other Homework 0 General Math 2 Introductory Physics Homework 14 Set Theory, Logic, Probability, Statistics 5 General Discussion 6