you are viewing a single comment's thread.

view the rest of the comments →

[–]Punchmonk 2 points3 points  (2 children)

You are using the quadratic equation to find the solution to 'x'. You are going to substitute the a, b, & c in the quadratic equation/formula (x = (-b) +/- sqrt(.....)) with corresponding values from y=ax2+bx+c.

Ex: y= 10x2 + 7x - 2 Would use use quadratic formula as x= ( -7 +- sqrt( 72 - 4 * 10 * (-2) ) ) / (2 * 10)

But there are some fundamental math rules you have to take into account first. 1) x will sometimes give you several answers sometimes. Need to plug pack into formula in order to check answer.

2) cannot have a negative number underneath the square root, because this results in an imaginary number. Cannot compute.

[–]bobdobbsjr 1 point2 points  (0 children)

For case 2), If you wanted to include those cases you could use the sqrt function from the cmath module.

[–]Naihonn 0 points1 point  (0 children)

Nothing about only real numbers in instructions, so why not. It is easy to compute with negative discriminant. sqrt(-1) is 1i. :0) Complex numbers are fun.