How to calculate all the possible combinations....?

In summary, Homework EquationsThe student tries to calculate all the possible combinations between two candles, using different combinations of the 4 variables of a candle.
  • #1
Richard_Steele
53
3

Homework Statement


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.

Homework Equations

The Attempt at a Solution

 
Physics news on Phys.org
  • #2
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.
 
  • #3
haruspex said:
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.
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 length (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.
 
  • #4
Richard_Steele said:
calculate all the possible combinations (
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?
 
  • #5
haruspex said:
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?
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?
 
  • #6
Richard_Steele said:
I have 16 relations and it's possible that each relation gives as a result 3 different properties: higher than, lower than or equal. (<, >, =).
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?
 
  • #7
haruspex said:
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?
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.
 
  • #8
Richard_Steele said:
assume that N = 2
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.
Richard_Steele said:
So the solution could be: 16?
Eh? Just two numbers, one for each candle: x1, x2. One greater than the other. How many possibilities?
 
  • #9
haruspex said:
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?
Sorry, maybe 2?
X1 > X2
or
X1 < X2

Now better?
 
  • #10
Richard_Steele said:
Sorry, maybe 2?
X1 > X2
or
X1 < X2

Now better?
Yes. What about N?
 
  • #11
haruspex said:
Yes. What about N?
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?
 
  • #12
Richard_Steele said:
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?
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.
 
  • #13
haruspex said:
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.
Well, if we have 3 numbers... (call them 1, 2 and 3)

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

Correct?
 
  • #14
Richard_Steele said:
Well, if we have 3 numbers... (call them 1, 2 and 3)

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

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

haruspex said:
Yes. Are you not familiar with the formula for the number of ways to order n objects?
I would say you that it's possible to get the result (6 possible combinations) using the permutation formula:
9117143f9377af0d62d2eec656e79a27.jpg


Right?
 
  • #16
Richard_Steele said:
you're asking me about the formula to order n objets
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.
 
  • #17
haruspex said:
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.

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?
 
  • #18
Richard_Steele said:
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?
Your list clearly shows three choices for the first position, 1, 2 or 3. The two you highlighted are the same choice.
 

What is the formula for calculating all possible combinations?

The formula for calculating all possible combinations is nCr = n! / (r! * (n-r)!), where n represents the total number of items and r represents the number of items being chosen at a time.

How do I calculate all possible combinations using a calculator?

Most scientific calculators have a built-in function for calculating combinations. Look for a "nCr" or "nCr" button and input the values for n and r to get the result.

Are there any shortcuts for calculating all possible combinations?

Yes, there are a few shortcuts that can be used to quickly calculate combinations. For example, if n and r are consecutive numbers, the result will always be the next higher number. Additionally, if r is half of n, the result will be 2^n / (n+1).

Can combinations be calculated for non-integer values?

Yes, the formula for calculating combinations can be applied to non-integer values as well. However, the result may not always be a whole number.

How can I use combinations in real-life situations?

Combinations can be used in various real-life situations such as in probability and statistics, in choosing lottery numbers, in creating passwords, and in organizing events with multiple options.

Similar threads

  • Calculus and Beyond Homework Help
Replies
12
Views
937
  • Calculus and Beyond Homework Help
Replies
1
Views
976
Replies
7
Views
548
  • Calculus and Beyond Homework Help
Replies
9
Views
685
  • Quantum Physics
Replies
32
Views
2K
  • Calculus and Beyond Homework Help
Replies
8
Views
2K
  • Quantum Interpretations and Foundations
2
Replies
38
Views
4K
  • Thermodynamics
Replies
1
Views
3K
  • Calculus and Beyond Homework Help
Replies
11
Views
3K
  • General Math
Replies
5
Views
1K
Back
Top