Problem with Getting Started q.2, how do I find the Positive root of the following equation: 34*x^2 + 68*x - 510 In the question it says: Recall: a*x^2 + b*x + c x1 = ( - b + sqrt ( b*b - 4*a*c ) ) / ( 2*a) I know that is the quadratic formula, but I haven't seen it in years, I forget what do do.
wait, after messing about a bit i think i got it, >>> import math >>> x1=(-68+math.sqrt(68*68-4*34*(-510)))/(2*34) >>> x1 3.0 is that right?
Try plugging it in for x and see if you get 0. To get the other root you would say "...-math.sqrt(..." (remember the +/- sign in the formula?). Similarly you can plug that x back in to check, too.
Another thing to notice is that each of those coefficients is divisible by 34. So you could factor that out and get to an expression with more manageable coefficients, and probably factor it by inspection.
Oh no, when I tried to plug it in, this happens... >>> 3=(-68+math.sqrt(68*68-4*34*(-510)))/(2*34) SyntaxError: can't assign to literal
use == instead of = if you are trying to do a comparison http://docs.python.org/library/stdtypes.html#comparisons
thanks!
>>> 3 ==(-68+math.sqrt(68*68-4*34*(-510)))/(2*34) True
That just shows that you got the same answer from that expression twice. You should plug 3 back in to the original expression (34*x^2 + 68*x - 510 ) and make sure that's 0.
Join our real-time social learning platform and learn together with your friends!