![]() ![]() If the value of discriminant is less than 0 then we print two complex roots using mathematical formula.If the value of discriminant is equal to 0 then we print two equal roots using mathematical formula.If the value of discriminant is greater than 0 then we print real roots using mathematical formula.Using if.elif.else we do the below steps Demonstration that quadratic equation gives wrong answer for large inputs.To perform complex square root, we imported the cmath module. Learn how to use Python programming to solve the quadratic equation ax2+bx+c0 with the standard formula. ![]() When the Value of discriminant is greater than 0 then there exist two complex roots for the quadratic equation. When the Value of discriminant is equal to 0 then there exist two equal roots for the quadratic equation. Which can be calculated using the above roots formula. When the Value of discriminant is greater than 0 then there exist two distinct roots for the quadratic equation Python Program to Calculate the Discriminant Valueģ)Calculating roots of Quadratic Equation roots = ( -b + sqrt(b ^ 2 - 4 * a *c) ) / (2 * a), ( -b - sqrt(b ^ 2 - 4 * a *c) ) / (2 * a). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |