1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to calculate all the possible combinations...?

  1. Apr 19, 2017 #1
    1. The problem statement, all variables and given/known data
    Hello, I have to solve a problem to calculate all the possible combinations in a dataset. I have candles and each one has 4 values: open, close, high and low. And I have a high number of candles (hundreds).

    I want to know all the possible scenarios that it's possible to obtain with 2 consecutive candles.

    For example, I have a candle:
    72930b1050e735374a79da87a0de82e2.jpg

    B1 can be below or above C1 (in the picture, there is only 1 candle and 2 different situations):
    a87926d7967fc4e779a042b3efe0c271.jpg
    As you can see, it has 4 variables (Max, min, open and close).

    What happens when we have 2 candles and we want to compare them
    Once we have 2 consecutive candles, there are different scenarios that we can find. Those possible scenarios are the things I want to calculate. How many combinations is it possible to find between 2 consecutive candles?
    ad3b7df2c1802c07c4dd6928c43ecee3.jpg
    In this case:
    A1 < A2
    B1 > B2
    C1 > C2
    D1 > D2


    But if we want to calculate all the possible combinations:
    A1 > A2 or A1 < A2 or A1 = A2
    A1 can be higher, lower or equal to B2
    etc...

    So we have different relations between the components:
    A1-A2, A1-B2, A1-C2...
    B1-A2, B1-B2, B1-C2...

    And the relations between the components...
    >, < or =


    So I don't know what kind of formulas or mathematic fields I need to calculate all the possible scenarios. I have thought about combinatorics, but maybe I have use also relational algebra.

    But to start with, I would appreciate if someone explains here how to solve this problem.

    2. Relevant equations


    3. The attempt at a solution
     
  2. jcsd
  3. Apr 19, 2017 #2

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    I am not at all sure I understand the question. Is this it:
    You have an ordered set of N candles.
    The candles are vertical.
    Each candle has an open end and a closed end.
    All candles are the same length (true?).
    For any given candle, two parameters describe its state: its vertical position and which way up it is.
    For the state of the system, you only care about which way up the candles are and the ranking of their heights.

    If the candles are of arbitrary lengths then you care about the ranking of the heights of their two ends independently.
     
  4. Apr 19, 2017 #3
    Hello, I have a set of N candles. The candles are vertical and each candle has 4 variables (maximum, minimum, open and close). Each candle can be equal or different lenght (usually they are different length).

    For any given candle 4 instead of 2, parameters are used to describe i: max, min, open and close. If I want to represent 1 candle, I need the 4 parameters to describe the candle.

    I care to calculate all the posible qualitative (not quantitative, at this moment) combinations are possible to find in the set.

    Here you have a real set:
    0fb1070c309ff6efb74d4116be326e54.jpg
    Despite the colors of the body (black or white). Imagine all candles are black for our thread.

    So, the problem I am facing is to calculate all the possible combinations (how can a parameter (max, min, high or low)) be in relation to another candle.
     
  5. Apr 19, 2017 #4

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Suppose you have N candles. How many candle ends are there? (For now, assume all are at different heights.). Now add one more. How many possibilities are there for how it is added?
     
  6. Apr 19, 2017 #5
    I have made the following observations. Check them and say me if I'm right or not.

    I have 2 candles, the first has the index #1, and the second has the index #2.


    I assume that if I want to calculate all the possible relations that can exist between each component of the first candle, with each of the components of the second candle, they're a total of 16 interactions. (4 * 4)


    Of course, now I have 16 relations and it's possible that each relation gives as a result 3 different properties: higher than, lower than or equal. (<, >, =).


    So I think there are 324 possible combinations:
    34=81
    81 * 4 = 324
    I have 3 different results (<, >, =).
    I have to apply in a block that has 4 different relations (one component of the first candle interacting with each one of the 4 components of the second candle).
    I have four blocks (each block is the interaction of each component of the first candle (4 in total, for that reason there are 4 blocks) with the components of the second candle).

    Is it right?
     
  7. Apr 19, 2017 #6

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    But not all those combinations are possible. If x>y and y=z then x>z.
    Start with something a bit simpler. Consider a single number to represent each candle, its midpoint say. So there are just N numbers. And for now, ignore the fact that some might be equal. How many possibilities?
     
  8. Apr 20, 2017 #7
    Well, assume that N = 2 , so I have 2 candles. The first and the second candle.

    Of course, I assume that they can be > or < (not equal).

    So the solution could be: 16? I don't get the idea.
     
  9. Apr 20, 2017 #8

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    That's making it a bit too simple. Keep it at N. With just one number for each and no equality, this is quite easy, but instructive.
    Eh? Just two numbers, one for each candle: x1, x2. One greater than the other. How many possibilities?
     
  10. Apr 21, 2017 #9
    Sorry, maybe 2?
    X1 > X2
    or
    X1 < X2

    Now better?
     
  11. Apr 21, 2017 #10

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Yes. What about N?
     
  12. Apr 22, 2017 #11
    I would say that if we have 2 candles and there are 2 possible solutions, then if we have N candles, we will have N possible solutions. Right?

    For example, if we have 4 candles, we will have 4 possible solutions?
     
  13. Apr 22, 2017 #12

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    That's a wild guess. And wrong. You have N numbers to put in some order... Doesn't anything spring to mind?
    If not, try N=3 and see if you can write down all the possble orders.
     
  14. Apr 27, 2017 #13
    Well, if we have 3 numbers... (call them 1, 2 and 3)

    We have the following combinations:
    123
    132
    213
    231
    312
    321

    Correct?
     
  15. Apr 27, 2017 #14

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Yes. Are you not familiar with the formula for the number of ways to order n objects?
     
  16. May 1, 2017 #15
    EDIT: you're asking me about the formula to order n objets. I'm not familiar with it.

    I would say you that it's possible to get the result (6 possible combinations) using the permutation formula:
    9117143f9377af0d62d2eec656e79a27.jpg

    Right?
     
  17. May 1, 2017 #16

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Yes. I find it astonishing that you would be expected to answer a question such as in this thread without being familiar with such a basic formula.

    Suppose you have n objects to put in order. How many choices for the object to go in the first position? Having made that choice, how many objects do you have left to choose from for the second position? Etc.
     
  18. May 14, 2017 #17
    How many choices for the object to go in the first position?
    2 choices?
    123
    132
    213
    231
    312
    321

    Having made that choice, how many objects do you have left to choose from for the second position?
    2 also?
     
  19. May 14, 2017 #18

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Your list clearly shows three choices for the first position, 1, 2 or 3. The two you highlighted are the same choice.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: How to calculate all the possible combinations...?
  1. How is this possible? (Replies: 12)

Loading...