Convert 2 variables into 1 representative variable

In summary, the conversation discusses the need to convert two variables A and B into one representative variable C, which is used to filter A and B. The example provided uses C=A+B and Set 2 is the highest value. The goal is to find a set with both A and B being close to 100 and a high A+B value. The conversation also mentions using the Pythagorean theorem and taking the largest difference to 100, as well as the possibility of extending these methods to three variables.
  • #1
1plus1is10
51
0
I need help to convert 2 variables A,B into 1 representative variable C, which is used to filter A,B:

Below is an example with C=A+B, which makes Set 2 the highest value:
Set 1: A=65, B=75, C=140;
Set 2: A=50, B=100, C=150;
Set 3: A=54, B=90, C=144;
Set 4: A=72, B=72, C=144;
Set 5: A=71, B=73, C=144;
Set 6: A=71, B=71, C=142;

But I want either Set 4 or 5, which has *both* A and B being closer to 100, and also a high A+B value.

If you know/understand computer code:
if(C>previousC) isBestSet=SetNumber;

I do not care if C is a big or small number, meaning I do not care if I need to pick the biggest or smallest C.
Thanks
 
Mathematics news on Phys.org
  • #2
1plus1is10 said:
I need help to convert 2 variables A,B into 1 representative variable C, which is used to filter A,B:

Below is an example with C=A+B, which makes Set 2 the highest value:
Set 1: A=65, B=75, C=140;
Set 2: A=50, B=100, C=150;
Set 3: A=54, B=90, C=144;
Set 4: A=72, B=72, C=144;
Set 5: A=71, B=73, C=144;
Set 6: A=71, B=71, C=142;
I'm not sure what adding A and B does for you, but it seems like you want to minimize the distance from a point (A, B) to the point (100, 100)
For set 4 (the point (72, 72) ), the distance is ##\sqrt{1568}##.
For set 5 (the point (71, 73) ), the distance is ##\sqrt{1570}##.
To calculate the distance of a point (A, B) to (100, 100), the formula is ##d = \sqrt{(100 - A)^2 + (100 - B)^2}##.
1plus1is10 said:
But I want either Set 4 or 5, which has *both* A and B being closer to 100, and also a high A+B value.

If you know/understand computer code:
if(C>previousC) isBestSet=SetNumber;

I do not care if C is a big or small number, meaning I do not care if I need to pick the biggest or smallest C.
Thanks
 
  • Like
Likes 1plus1is10
  • #3
Wow. Perfect. Thank you very much.

I Googled: "minimize the distance from a point"
I see that this technique is actually the Pythagorean theorem, which leads me to another question:

Sometimes my Sets have 3 variables instead of 2.
Is it safe to *assume* that I simply tack on another: + (100-3rdVar)^2
(i.e. since there is no real need for me to preform the final square root)

Thanks again.
 
  • #4
1plus1is10 said:
Wow. Perfect. Thank you very much.

I Googled: "minimize the distance from a point"
I see that this technique is actually the Pythagorean theorem, which leads me to another question:

Sometimes my Sets have 3 variables instead of 2.
Is it safe to *assume* that I simply tack on another: + (100-3rdVar)^2
(i.e. since there is no real need for me to preform the final square root)

Thanks again.
Yes, distance in three dimensions is ##d = \sqrt{(x_1 - y_1)^2 + (x_2 - y_2)^2 + (x_3 - y_3)^2}##. And if ##(x_1, x_2, x_3)## and ##(y_1, y_2, y_3)## are the minimum distance apart, the square of their distance, ##d^2##, will also be at a minimum.
 
  • Like
Likes 1plus1is10
  • #5
You can also take the largest difference to 100, C=max(100-A, 100-B). There are many functions, the best for you depends on what exactly you want to prefer over what.

All methods discussed can be extended to 3 variables easily.
 
  • #6
Excellent.
Thanks again Mark!

mfb,
Thanks anyway, but Mark nailed it for me right on the head.
 

What is the purpose of converting 2 variables into 1 representative variable?

The purpose of converting 2 variables into 1 representative variable is to simplify data analysis and interpretation. By combining two related variables, we can reduce the complexity of the data and make it more manageable.

What are some common methods for converting 2 variables into 1 representative variable?

Some common methods for converting 2 variables into 1 representative variable include averaging, weighting, and principal component analysis. These methods can help identify patterns and relationships within the data.

How do you determine which method to use for converting 2 variables into 1 representative variable?

The method used for converting 2 variables into 1 representative variable depends on the type of data, the research question, and the desired outcome. It is important to carefully consider these factors before selecting a method.

What are some potential drawbacks of converting 2 variables into 1 representative variable?

One potential drawback is that important information may be lost during the conversion process. Additionally, the resulting representative variable may not accurately reflect the relationship between the original variables.

Can converting 2 variables into 1 representative variable improve the accuracy of a study?

In some cases, converting 2 variables into 1 representative variable can improve the accuracy of a study by reducing noise and increasing the strength of the relationship between variables. However, this is not always the case and careful consideration should be taken before using this method.

Similar threads

Replies
6
Views
3K
  • General Math
Replies
4
Views
1K
Replies
80
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
123
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
1K
  • General Math
Replies
1
Views
727
Replies
6
Views
1K
Replies
1
Views
2K
  • Quantum Interpretations and Foundations
2
Replies
45
Views
3K
Back
Top