I Convert 2 variables into 1 representative variable

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 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 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.
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
I'm interested to know whether the equation $$1 = 2 - \frac{1}{2 - \frac{1}{2 - \cdots}}$$ is true or not. It can be shown easily that if the continued fraction converges, it cannot converge to anything else than 1. It seems that if the continued fraction converges, the convergence is very slow. The apparent slowness of the convergence makes it difficult to estimate the presence of true convergence numerically. At the moment I don't know whether this converges or not.
Back
Top