Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Ever get stuck on a formula?

Ever get stuck on a formula?

Scheduled Pinned Locked Moved The Lounge
comhelpquestion
22 Posts 16 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K kmoorevs

    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

    C Offline
    C Offline
    charlieg
    wrote on last edited by
    #11

    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

    1 Reply Last reply
    0
    • K kmoorevs

      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

      J Offline
      J Offline
      jerryr4
      wrote on last edited by
      #12

      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

      R W J U 4 Replies Last reply
      0
      • J jerryr4

        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

        R Offline
        R Offline
        Rage
        wrote on last edited by
        #13

        ... and c needs to be not equal to d ...

        Do not escape reality : improve reality !

        1 Reply Last reply
        0
        • K kmoorevs

          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

          G Offline
          G Offline
          Gary Wheeler
          wrote on last edited by
          #14

          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;

          1 Reply Last reply
          0
          • J jerryr4

            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

            W Offline
            W Offline
            W Balboos GHB
            wrote on last edited by
            #15

            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.

            Ravings en masse^

            "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

            1 Reply Last reply
            0
            • K kmoorevs

              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

              K Offline
              K Offline
              Kirk 10389821
              wrote on last edited by
              #16

              As a math minor I suddenly understand the disdain for cliffs notes... LOL

              1 Reply Last reply
              0
              • K kmoorevs

                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

                M Offline
                M Offline
                Marc Clifton
                wrote on last edited by
                #17

                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 d

                I'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-c

                Latest 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

                K 1 Reply Last reply
                0
                • M Marc Clifton

                  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 d

                  I'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-c

                  Latest 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

                  K Offline
                  K Offline
                  kmoorevs
                  wrote on last edited by
                  #18

                  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

                  1 Reply Last reply
                  0
                  • J jerryr4

                    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

                    J Offline
                    J Offline
                    jackbrownii
                    wrote on last edited by
                    #19

                    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

                    J 1 Reply Last reply
                    0
                    • J jackbrownii

                      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

                      J Offline
                      J Offline
                      jerryr4
                      wrote on last edited by
                      #20

                      Probably took me the same amount of time by a slightly different route: You're right, I thought of this after having written the route. Jerry

                      1 Reply Last reply
                      0
                      • J jerryr4

                        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

                        U Offline
                        U Offline
                        User 11319743
                        wrote on last edited by
                        #21

                        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.

                        1 Reply Last reply
                        0
                        • K kmoorevs

                          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

                          M Offline
                          M Offline
                          maze3
                          wrote on last edited by
                          #22

                          oh wow, thanks. helped prove that the following does simplify (A / (B * C) ) * B simplifies to A / C

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups