Ever get stuck on a formula?
-
charlieg wrote:
Now, can you derive the equation of a line given two points?
Without looking slope = rise/run so m = (y2-y1)/(x2-x1) :laugh: (probably not right at all) Now you're making my brain hurt again! :laugh: btw, after revisiting my original problem, and thinking a little harder, I was able to work it out. :)
"Go forth into the source" - Neal Morse
It was rhetorical :) Slope is correct, but the y intercept? I worked with a coder who was a wizard in C++. But he had no idea how to code a linear function to calculate a simulated value... anyway, good math links
Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
-
Last week while working on a new report, I needed a formula that would calculate a shortage/overage for a variable and had the equation worked out as follows: a/(a+b) = c/d where I was solving for the variable a. It's been 30 years since I had algebra, and I struggled with a half dozen attempts at getting 'a' by itself on the left side, but nothing checked out. On a hunch, I did a quick google search and found this: https://www.mathway.com/Algebra[^] All you do is type in your formula, then it asks which variable you want to solve for. Brilliant!
"Go forth into the source" - Neal Morse
It's trivial https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley\_wink.gif, even after almost 60 years away from Grammar School in England. The steps are, using C formulae: a / (a + b) = c / d Multiply both sides by (a + b) a = (a + b) * c / d Collect the terms in a a - a * c / d = b * c / d Collect the coefficients of a a * (1 - c / d) = b * c / d Divide both sides by (1 - c / d) a = b * c / d / (1 - c / d) Simplify a = b * c / (d - c) Hope that's right, solved before you would have found the program In those good old days you got the algebra beaten into you Show-off Jerry
-
It's trivial https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley\_wink.gif, even after almost 60 years away from Grammar School in England. The steps are, using C formulae: a / (a + b) = c / d Multiply both sides by (a + b) a = (a + b) * c / d Collect the terms in a a - a * c / d = b * c / d Collect the coefficients of a a * (1 - c / d) = b * c / d Divide both sides by (1 - c / d) a = b * c / d / (1 - c / d) Simplify a = b * c / (d - c) Hope that's right, solved before you would have found the program In those good old days you got the algebra beaten into you Show-off Jerry
... and c needs to be not equal to d ...
-
Last week while working on a new report, I needed a formula that would calculate a shortage/overage for a variable and had the equation worked out as follows: a/(a+b) = c/d where I was solving for the variable a. It's been 30 years since I had algebra, and I struggled with a half dozen attempts at getting 'a' by itself on the left side, but nothing checked out. On a hunch, I did a quick google search and found this: https://www.mathway.com/Algebra[^] All you do is type in your formula, then it asks which variable you want to solve for. Brilliant!
"Go forth into the source" - Neal Morse
a/(a+b) = c/d
a = c(a+b)/d
a = ca/d + cb/d
a - ca/d = cb/d
ad - ac = cb
a(d-c) = cb
a = cb/(d-c)A slightly different version from Jerry's. I had 32 credit-hours of math in college - calculus, differential equations, and matrix algebra. All of it's gone, with the space in my head now used for old movie lines. The algebra's stayed around, as it seems to come in handy now and then.
Software Zen:
delete this;
-
It's trivial https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley\_wink.gif, even after almost 60 years away from Grammar School in England. The steps are, using C formulae: a / (a + b) = c / d Multiply both sides by (a + b) a = (a + b) * c / d Collect the terms in a a - a * c / d = b * c / d Collect the coefficients of a a * (1 - c / d) = b * c / d Divide both sides by (1 - c / d) a = b * c / d / (1 - c / d) Simplify a = b * c / (d - c) Hope that's right, solved before you would have found the program In those good old days you got the algebra beaten into you Show-off Jerry
I am so grateful for a post from someone who doesn't feel being innumerate is a way to be part of some team. Like the slope-of-a-line question. dy/dx - WTF's the difficulty with high school math? Something akin to pride as a consequence of membership in a pool of those who "can't" seems to be spreading from the TV and Radio to CP. Maybe the problem with poor code isn't only from the mass-production hordes now being unleashed? Alas.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010
-
Last week while working on a new report, I needed a formula that would calculate a shortage/overage for a variable and had the equation worked out as follows: a/(a+b) = c/d where I was solving for the variable a. It's been 30 years since I had algebra, and I struggled with a half dozen attempts at getting 'a' by itself on the left side, but nothing checked out. On a hunch, I did a quick google search and found this: https://www.mathway.com/Algebra[^] All you do is type in your formula, then it asks which variable you want to solve for. Brilliant!
"Go forth into the source" - Neal Morse
As a math minor I suddenly understand the disdain for cliffs notes... LOL
-
Last week while working on a new report, I needed a formula that would calculate a shortage/overage for a variable and had the equation worked out as follows: a/(a+b) = c/d where I was solving for the variable a. It's been 30 years since I had algebra, and I struggled with a half dozen attempts at getting 'a' by itself on the left side, but nothing checked out. On a hunch, I did a quick google search and found this: https://www.mathway.com/Algebra[^] All you do is type in your formula, then it asks which variable you want to solve for. Brilliant!
"Go forth into the source" - Neal Morse
kmoorevs wrote:
a/(a+b) = c/d where I was solving for the variable a.
It's a lot easier to see the solution when one writes it like:
a c
------ = ---
a + b dI'm a firm believer that visualizing (or expressing) the problem correctly is 90% of the solution. Given the above, cross multiply to get:
ad = c (a+b)
then:
ad = ca + cb
ad - ca = cb
a(d-c) = cb
cb
a = ---------
d-cLatest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
-
kmoorevs wrote:
a/(a+b) = c/d where I was solving for the variable a.
It's a lot easier to see the solution when one writes it like:
a c
------ = ---
a + b dI'm a firm believer that visualizing (or expressing) the problem correctly is 90% of the solution. Given the above, cross multiply to get:
ad = c (a+b)
then:
ad = ca + cb
ad - ca = cb
a(d-c) = cb
cb
a = ---------
d-cLatest Article - A Concise Overview of Threads Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
Thanks Marc, Given the answer I was able to see where I was going wrong! :laugh: It's a good reminder that math is a skill that diminishes with nonuse. Using calculators and spreadsheets for a couple of decades is taking it's toll. :doh: Maybe we should have a MQOTW? :)
"Go forth into the source" - Neal Morse
-
It's trivial https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley\_wink.gif, even after almost 60 years away from Grammar School in England. The steps are, using C formulae: a / (a + b) = c / d Multiply both sides by (a + b) a = (a + b) * c / d Collect the terms in a a - a * c / d = b * c / d Collect the coefficients of a a * (1 - c / d) = b * c / d Divide both sides by (1 - c / d) a = b * c / d / (1 - c / d) Simplify a = b * c / (d - c) Hope that's right, solved before you would have found the program In those good old days you got the algebra beaten into you Show-off Jerry
Probably took me the same amount of time by a slightly different route: a/(a+b)=c/d Multiply both sides by (a+b) and by d ad = c(a+b) Expand ad = ac + bc Subtract ac from both sides ad - ac = bc Collect the coefficients of a a(d-c) = bc Divide both sides by (d-c) a = bc/(d-c) Oh, if only all the equations were linear. ;P
-
Probably took me the same amount of time by a slightly different route: a/(a+b)=c/d Multiply both sides by (a+b) and by d ad = c(a+b) Expand ad = ac + bc Subtract ac from both sides ad - ac = bc Collect the coefficients of a a(d-c) = bc Divide both sides by (d-c) a = bc/(d-c) Oh, if only all the equations were linear. ;P
-
It's trivial https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley\_wink.gif, even after almost 60 years away from Grammar School in England. The steps are, using C formulae: a / (a + b) = c / d Multiply both sides by (a + b) a = (a + b) * c / d Collect the terms in a a - a * c / d = b * c / d Collect the coefficients of a a * (1 - c / d) = b * c / d Divide both sides by (1 - c / d) a = b * c / d / (1 - c / d) Simplify a = b * c / (d - c) Hope that's right, solved before you would have found the program In those good old days you got the algebra beaten into you Show-off Jerry
I got a slightly different (if not simpler) answer. a/(a+b) = c/d a = c/d*(a+b) a*d/c = a+b a*d/c -a = b a*(d/c -1) = b a=b/(d/c-1) Which if you multiply the numerator & denominator by c you'll get the answer the machine reports.
-
Last week while working on a new report, I needed a formula that would calculate a shortage/overage for a variable and had the equation worked out as follows: a/(a+b) = c/d where I was solving for the variable a. It's been 30 years since I had algebra, and I struggled with a half dozen attempts at getting 'a' by itself on the left side, but nothing checked out. On a hunch, I did a quick google search and found this: https://www.mathway.com/Algebra[^] All you do is type in your formula, then it asks which variable you want to solve for. Brilliant!
"Go forth into the source" - Neal Morse