Convert 2 variables into 1 representative variable

Click For Summary

Discussion Overview

The discussion revolves around the conversion of two variables, A and B, into a single representative variable, C, for the purpose of filtering and selecting optimal sets based on certain criteria. Participants explore various mathematical approaches and functions to achieve this, including distance minimization and alternative formulations.

Discussion Character

  • Exploratory
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant suggests using C = A + B to evaluate different sets, but expresses a desire for a method that also considers the proximity of A and B to the value of 100.
  • Another participant proposes calculating the distance from the point (A, B) to (100, 100) using the formula d = √((100 - A)² + (100 - B)²) to find sets that are closer to this target.
  • A later reply confirms that the distance formula can be extended to three variables by adding another term for the third variable, suggesting that the final square root may not be necessary for comparison purposes.
  • Another participant introduces the idea of using the maximum difference from 100, C = max(100 - A, 100 - B), indicating that the choice of function depends on specific preferences in the filtering process.

Areas of Agreement / Disagreement

Participants generally agree on the need to find a representative variable that considers both the sum of A and B and their proximity to 100. However, multiple competing views on the best approach remain, with no consensus on a single method.

Contextual Notes

Some participants mention that the methods discussed can be easily extended to three variables, but there is no resolution on which method is definitively superior for all scenarios.

Who May Find This Useful

This discussion may be useful for individuals interested in mathematical modeling, optimization problems, or those working with multi-variable data analysis in fields such as data science or engineering.

1plus1is10
Messages
51
Reaction score
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
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   Reactions: 1plus1is10
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.
 
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   Reactions: 1plus1is10
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.
 
Excellent.
Thanks again Mark!

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

Similar threads

  • · Replies 80 ·
3
Replies
80
Views
8K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
Replies
6
Views
3K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K