Quadratics or quadratic equations can be defined as a polynomial equation of a second degree, which implies that it comprises a minimum of one term that is squared. The general form of the quadratic equation is:
ax² + bx + c = 0
where x is an unknown variable and a,b,c are numerical coefficients
Here, a ≠ 0 because if it equals zero then the equation will not remain quadratic anymore and it will become a linear equation, such as:
bx+c= 0
Suppose, ax² + bx + c = 0 is the quadratic equation, then the formula to find the roots of this equation will be:
x = [-b±√(b2-4ac)]/2
The sign of plus/minus indicates there will be two solutions for x. Learn in detail the quadratic formula here.
Now it’s time to calculate the roots.
Tips to follow :
Take the input of the coefficients of a, b and c from the user.
The formula to calculate the roots of the quadratic equation is
[-b±√(b ** 2 - (4 * a *c))]/2
First calculate (b ** 2 - (4 * a * c)) and store it in some variable called d for instance.
If d < 0 - It means that the equation has no real roots.
If d = 0 - then calculate (-b / 2a) It means that the equation has double roots.
If d > 0 - then calculate the 2 roots by substituting in the formula. You will get 2 roots.
Post a Comment
0Comments