B Reduce Math in Formula Algebraically: BestCost

  • B
  • Thread starter Thread starter 1plus1is10
  • Start date Start date
  • Tags Tags
    Formula
AI Thread Summary
The discussion centers on simplifying the formula for calculating BestCost, which aims to filter out costs exceeding two-thirds of the low range of the average. Participants clarify that the average referenced is actually the midrange, derived from the highest and lowest values. There is a suggestion to use an if statement for filtering values in code, as well as a recommendation to sort costs to identify the lowest third directly. Ultimately, the original formula is deemed unnecessary, with a simpler approach to determining BestCost proposed. The conversation highlights the importance of clear definitions in mathematical terms and the potential for simplification in coding.
1plus1is10
Messages
51
Reaction score
0
Is there a way to reduce the math in my formula algebraically:
BestCost = lowest+((((highest+lowest)/2)-lowest)*0.6667);

I want to use BestCost to filter out any Cost that is higher than 2/3 of the low range of the average. I hope that makes sense.

Thanks
 
Mathematics news on Phys.org
1plus1is10 said:
Is there a way to reduce the math in my formula algebraically:
BestCost = lowest+((((highest+lowest)/2)-lowest)*0.6667);

I want to use BestCost to filter out any Cost that is higher than 2/3 of the low range of the average. I hope that makes sense.
"Filter out" implies to me that you want to discard or ignore some values. Based on your use of a semicolon at the end of your formula, I suspect that this is part of some code, possibly C or a language derived from C. If that's the case, to filter out values, you need an if statement.

What do you mean by "low range of the average?" The average (or mean) is a single number. What you're calculating in your formula with (highest + lowest)/2 is called the midrange.

It would help if you provided a reasonably small list of numbers, and showed what your calculation is supposed to do.
 
  • Like
Likes 1plus1is10
You are very perceptive and bright - yes, it is code and after messing with it for quite some time now - I stopped to think about it. And "midrange" is exactly what I want. Unfortunately, I was getting confused in my head with median, mean, and price range. In the end, I will have to ditch my formula, and instead, simply sort my Costs to determine the correct 1/3 lowest.

Random costs after sorting: 1,2,3,4,5,6,7,8,9,10,11,12
BestCost = anything below the 4th one in the list;

Thanks for your help.
 
Your formula uses only linear operations. You can simplify it step by step until you get something like BestCost = a*lowest+b*highest with some coefficients a and b.
If a+b=1 (which is the case here) then you calculate a weighted average of the two numbers. BestCost is then always at the same relative place in the interval from lowest to highest.
 
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...
Thread 'Imaginary Pythagorus'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top