
Help: how to solve a SECOND DEGREE equation in VB
Quote:
> I need to solve a second degree equation in Visual Basic .... something
> like this:
> 12.32*X^2+179.24*X-958.1625=0
> and I need Visual basic to choose the "positive"(X=4.157) solution from
> the equation.
Why not apply the quadratic formula, which gives both roots, and test the
results to see if you got a positive one? My memory of high-school math may
be faulty, but as I recall it:
Root1 = ((-B) + Sqr((B^2) - 4AC) / 2A
Root2 = ((-B) - Sqr((B^2) - 4AC) / 2A
...where A is 12.32, B is 179.24, and C is 958.1625, in your formula
-- Jim