Determining Combinations with Restraints

  • Context: Undergrad 
  • Thread starter Thread starter Altermeris
  • Start date Start date
  • Tags Tags
    Combinations
Click For Summary

Discussion Overview

The discussion revolves around determining the number of unique permutations of colored objects (black and white) under specific constraints. Participants explore combinatorial formulas and programming approaches to address the problem, which involves 16 objects split evenly between two colors.

Discussion Character

  • Exploratory, Technical explanation, Debate/contested, Mathematical reasoning

Main Points Raised

  • One participant expresses uncertainty about applying combination and permutation formulas with constraints, specifically for 16 objects divided into 8 black and 8 white.
  • Another participant suggests clarifying the question by outlining scenarios and the number of states per scenario, proposing different interpretations of the problem.
  • A participant shares a brute force programming approach to solve the problem, mentioning a sequence formula derived from their findings: An=C(2n,n).
  • Some participants request clearer descriptions of the problem, indicating confusion over the initial explanation and the relevance of the provided Java code.
  • A later reply reiterates the problem using a different phrasing, asking how many ways to arrange n coins (n/2 black and n/2 white) in a line, suggesting the use of the combination formula \binom{n}{n/2}.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the problem's clarity or the appropriate approach to find a solution. Multiple interpretations and methods are proposed, indicating ongoing uncertainty and disagreement.

Contextual Notes

Limitations include unclear assumptions about the arrangement of objects, the definitions of states, and the specific constraints of the problem. The discussion reflects various mathematical approaches without resolving the underlying questions.

Altermeris
Messages
3
Reaction score
0
I'm loosely familiar with the formulas for combinations and permutations. However, I don't know how to use the formula with restraints.

Here is the specific issue I am having:

Number of Objects: 16
Number of States: 2
Number of Black Objects 8
Number of White Objects: 8

How many unique permutations color permutations are possible?​
I know that for the first and last 8 both have 2^8 permutations, so there is a minimum of 512 permutations.
 
Physics news on Phys.org
I'm sorry, I don't understand the question.
 
Hey Altermeris and welcome to the forums.

Your question is unclear but one recommendation to make it clearer is to write the scenarios and then write how many states per scenario.

For example 2 states per object for 16 objects is 32 states, or 2 states per combination of every pair of objects selected without replacemet is 2*16*15 = 480 or 512 if with replacement.

This kind of thing would be a lot more informative and cause less confusion.
 
I wrote a brute force program to solve the problem. By punching in the output of the brute forcing algorithm into WolframAlpha, I was able to find the sequence formula to solve this problem.

An=C(2n,n)

Code:
public class BruteForcePermutation {
    
    public static boolean countUniqueChar(int num, char symb, String text){
        int count = 0;
        int textLength = text.length();
        char[] charArray = new char[textLength];
        
        charArray = text.toCharArray();
        
        for(int i = 0; i<textLength; i++)
            if(charArray[i]==symb)count++;
        
        if(count==num) return true;
        else return false;   
    }
    
    public static String intToBinary(int num, int size){
        String result = "";
        
        while(num!=0){
            result = (num%2) + result;
            num /= 2;
            size--;
        }
        
        while(size>0){
            result = "0" + result;
            size--;
        }
        
        return result;
    }
    
    public static void main(String[] args){
        String currentBin = "";
        int permutations;
        
        int terms = 10;
        for(int size = 2; size<=terms*2;size+=2){
            permutations = 0;
            for(int i = 0; i<Math.pow(2,size) ;i++){
                currentBin = intToBinary(i,size);
                if(countUniqueChar((size/2),'1',currentBin)){
                    //System.out.println(currentBin);
                    permutations++;
                }
            }
        System.out.print(permutations + " ");
        }
    }
}

I was working on this problem in particular in hope of creating a more efficient algorithm for a pathing problem.
 
OK, so have you solved the problem to your satisfaction? If not, then could you please post a better description of your problem, because I don't want to read through Java to try to figure out what you mean.
 
Robert1986 said:
OK, so have you solved the problem to your satisfaction? If not, then could you please post a better description of your problem, because I don't want to read through Java to try to figure out what you mean.

I am still unsure about how to determine the formula by observation.

I'll try describing the problem differently.

If you have a bag of n-Coins that contain (n/2) black coins and (n/2) white coins, how many ways can you place the white and black coins in a line of n?
 
Altermeris said:
I am still unsure about how to determine the formula by observation.

I'll try describing the problem differently.

If you have a bag of n-Coins that contain (n/2) black coins and (n/2) white coins, how many ways can you place the white and black coins in a line of n?
[tex]\binom{n}{n/2}[/tex]
the number of combinations of n objects taken n/2 at a time.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 8 ·
Replies
8
Views
1K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 18 ·
Replies
18
Views
3K