GatewayRedbirds.com

A Message Board Dedicated to Discussing St. Louis Cardinals Baseball!
It is currently May 21 13, 6:29 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Another Math Question
PostPosted: June 6 12, 3:22 pm 
Offline
Next Gen Wart
User avatar

Joined: April 22 06, 6:53 pm
Posts: 7102
Location: St. Louis
So i'm trying to find out how to count the number of possible outputs there are if you have five variables:

say a,b,c,d,e.

I know that if you have 5 of them with 5 different rows you'd just have 25 possibilities. But mine need to start from 2 groupings each and end at 5 ie:
ab
abc
abcd
abcde

I think you'd normally just do 5x4x3x2 and that would tell you there's 120 possibilities there.

But in my circumstance each value only counts once, ie abc,acb,cab,cba etc. are all the same value.

The 5 values might change, so manually writing them out seems like a waste of time when I really just need some sort of equation of formula. Sadly i'm way not smart enough to figure that out on my own. Anyone have any ideas?

_________________
Image


Top
 Profile  
 
PostPosted: June 6 12, 3:27 pm 
Offline
is unaware that dangerous is the real Tyler Durden
User avatar

Joined: June 10 09, 11:31 pm
Posts: 10774
Location: 1 block from In-N-Out
I think it is the sum of 2! + 3! + 4! + 5!.

_________________
Image


Top
 Profile  
 
PostPosted: June 6 12, 3:28 pm 
Offline
Perennial All-Star
User avatar

Joined: July 1 06, 7:24 pm
Posts: 3145
i must be missing something here... would it not just be 5^0*5^1*5^2*5^3*5^4?

are the following two scenarios two different iterations of what you're looking for?

ab
bed
aced
baced

ac
ced
bced
cabed

and the following two the same iteration?

ab
bed
aced
baced

ba
deb
deca
decab

if the answer to the above two questions is right, i think i'm right...

edit: no, this is wrong, but i'm close...


Top
 Profile  
 
PostPosted: June 6 12, 3:47 pm 
Offline
Next Gen Wart
User avatar

Joined: April 22 06, 6:53 pm
Posts: 7102
Location: St. Louis
I found some javascript code that I was able to slightly modify to do it. A little above my ability to grasp (it takes arrays and combines the output via the concat functoin...so I get it, but I wouldn't be able to write it from scratch) that output it for me:

ab,
ac,
ad,
ae,
bc,
bd,
be,
cd,
ce,
de,
abc,
abd,
abe,
acd,
ace,
ade,
bcd,
bce,
bde,
cde,
abcd,
abce,
abde,
acde,
bcde

The code if anyone is interested:
Spoiler: show
Code:
<html>
<head></head>
<body>
<script type="text/javascript">
var combine = function(a, min) {
    var fn = function(n, src, got, all) {
        if (n == 0) {
            if (got.length > 0) {
                all[all.length] = got;
            }
            return;
        }
        for (var j = 0; j < src.length; j++) {
            fn(n - 1, src.slice(j + 1), got.concat([src[j]]), all);
        }
        return;
    }
    var all = [];
    for (var i = min; i < a.length; i++) {
        fn(i, a, "<br/> ", all);
    }
    all.push(a);
    return all;
}
var subsets = combine(["a", "b", "c", "d", "e"], 2);
document.write(subsets);
</script>
</body>

_________________
Image


Top
 Profile  
 
PostPosted: June 6 12, 3:51 pm 
Offline
Perennial All-Star
User avatar

Joined: April 18 06, 10:37 pm
Posts: 5109
TheoSqua wrote:
So i'm trying to find out how to count the number of possible outputs there are if you have five variables:

say a,b,c,d,e.

I know that if you have 5 of them with 5 different rows you'd just have 25 possibilities. But mine need to start from 2 groupings each and end at 5 ie:
ab
abc
abcd
abcde

I think you'd normally just do 5x4x3x2 and that would tell you there's 120 possibilities there.

But in my circumstance each value only counts once, ie abc,acb,cab,cba etc. are all the same value.

The 5 values might change, so manually writing them out seems like a waste of time when I really just need some sort of equation of formula. Sadly i'm way not smart enough to figure that out on my own. Anyone have any ideas?

I don't know if this is what you are looking for, but the formula for a combination is
Image
where n is the number of variables and k is the combination of variables. So if you have a, b, c, d, and e, to find how many combinations of two letters there are, the formula would be 5! / (2! * (5 - 2)!) = 10. To find how many combinations of three there are 5! / (3! * (5 - 3)!) = 10. Four combinations 5! / (4! * (5 - 4)!) = 5. Five combinations = 1. Sum them to get 26 possible outputs.


Top
 Profile  
 
PostPosted: June 6 12, 3:52 pm 
Offline
Red Lobster for the seafood lover in you

Joined: May 1 06, 2:41 pm
Posts: 37803
Location: You can find me in the tub, bottle full of bub
You aren't specific enough with your question. Are you asking how many combinations (order doesn't matter), or permutations (order does matter)? What do you mean five variables? How many values can those variables take?

You need to restate your question. I can answer it for you if you can express it mathematically. This is a simple Combinatorics problem, which I was a class I aced some years ago.

_________________
"Boy, that was exciting. I always say it ain't over til it's over, but that one should've been over a while ago." ~ Yogi Berra


Last edited by jim on June 6 12, 3:54 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: June 6 12, 3:53 pm 
Offline
Perennial All-Star
User avatar

Joined: July 1 06, 7:24 pm
Posts: 3145
Ah, i get it now. It's interesting that both the 2-letter groups and the 3 letter groups both get you 10 outputs but seemingly get there in completely different ways.


Last edited by RxOfCowbell on June 6 12, 3:55 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: June 6 12, 3:55 pm 
Offline
Perennial All-Star
User avatar

Joined: July 1 06, 7:24 pm
Posts: 3145
longhornbaseball wrote:
TheoSqua wrote:
So i'm trying to find out how to count the number of possible outputs there are if you have five variables:

say a,b,c,d,e.

I know that if you have 5 of them with 5 different rows you'd just have 25 possibilities. But mine need to start from 2 groupings each and end at 5 ie:
ab
abc
abcd
abcde

I think you'd normally just do 5x4x3x2 and that would tell you there's 120 possibilities there.

But in my circumstance each value only counts once, ie abc,acb,cab,cba etc. are all the same value.

The 5 values might change, so manually writing them out seems like a waste of time when I really just need some sort of equation of formula. Sadly i'm way not smart enough to figure that out on my own. Anyone have any ideas?

I don't know if this is what you are looking for, but the formula for a combination is
Image
where n is the number of variables and k is the combination of variables. So if you have a, b, c, d, and e, to find how many combinations of two letters there are, the formula would be 5! / (2! * (5 - 2)!) = 10. To find how many combinations of three there are 5! / (3! * (5 - 3)!) = 10. Four combinations 5! / (4! * (5 - 4)!) = 5. Five combinations = 1. Sum them to get 26 possible outputs.


=D>

I should probably take a statistics course. Is this that "n choose r" thing or whatever?


Top
 Profile  
 
PostPosted: June 6 12, 4:50 pm 
Offline
Red Lobster for the seafood lover in you

Joined: May 1 06, 2:41 pm
Posts: 37803
Location: You can find me in the tub, bottle full of bub
You get a good dose of this in a Combinatorics or Discrete Math class. That was a requirement for CS majors back in the day (probably still is most places), so I had it.

_________________
"Boy, that was exciting. I always say it ain't over til it's over, but that one should've been over a while ago." ~ Yogi Berra


Top
 Profile  
 
PostPosted: June 6 12, 6:15 pm 
Offline
Next Gen Wart
User avatar

Joined: April 22 06, 6:53 pm
Posts: 7102
Location: St. Louis
jim wrote:
You get a good dose of this in a Combinatorics or Discrete Math class. That was a requirement for CS majors back in the day (probably still is most places), so I had it.

I only have an associates :) they didn't make me go past college algebra. I honestly have no idea what exclamation points have to do with math.

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: JackofDiamonds, Smith Corks One and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group