Isolating a variable gives me endless loop

  • Thread starter Thread starter HKragh
  • Start date Start date
  • Tags Tags
    Loop Variable
HKragh
Messages
12
Reaction score
0
Coming in here with the following question, when I see what kind of stuff you normally tackle, is very embarrassing! But... I simply am too rusty for this stuff, it seems. This is NOT homework. This is something I need to do in a game I'm working on.

I end up in and endless loop when trying to isolate a variable of an equation. And I have no idea what approach to use to get out of it.

After lots of moving around in the original equation, I end up with this. Which is correct, if I plot in some values. But I need to have a completely isolated.

a=b-((c*d)/a)

Then I try to multiply by "a" on all

a^2 = b*a-c*d

So Now I need to divide by "a"

a = b-((c*d)/a)

Aaand. I'm back.

Please help me out with what seems to be VERY easy, if you know your stuff.
 
Mathematics news on Phys.org
One of my colleagues helped me out. This is, as you probably already know, a second degree polynomial. So just to make sure the solution is in here, even though none of you probably care:

The variable names are based on the equation above, and so the placement of each might seem out of place with the standard look of it.

D=b^2-4cd

a = (-b+-sqrt(D))/-2

D>0 : 2 solutions
D=0 : 1 solution
D<0 : 0 solutions
 
Yes, by identifying the equation as a quadratic polynomial then you know to use the quadratic formula:

http://en.wikipedia.org/wiki/Quadratic_formula

Its good you answered you own question and posted it as well.

----------------------------------------------------------------------------

So once you have the equation as a^2 = b*a-c*d and rewrite it as: a^2 - ba + cd = 0

then you can see it matches the Ax^2 + Bx + C = 0 format where in your case x=a, A = 1, B=b, C=cd

and the roots for x are (ie your a) are: x = -B/2A +- sqrt(B^2 - 4AC) / 2A

a = -b/2 +- sqrt(b^2 - 4cd)
 
Last edited:
thx for the extra info, jedishrfu! At some point in life (technical high school thingy) I knew more about this stuff, and solved many problems like this. Then time went by, and I forgot it all. I must say yesterdays experience has made it clear I need to rediscover this set of skills! It must be buried in there, somewhere... :)
 
The things we learn last are the things we forget first. I know the feeling.
 
Your "endless loop" came, of course, from your "multiplying by a" in the first step and them "dividing by a" in the second step! Multiplication and division are inverse operations so, in the second step, you just "undid" what you did in the first step.
 
I know :) The problem was that the only method I knew at the time to get rid of the "a" was by multiplying by it on all terms. And then I had the "a" still as a multiplication, and only knew division as a method to get rid of that. I very much aware how that got me into the loop. That is why I searched for a completely different method than simply multiplying and dividing my term.
 
Back
Top