Write a function @numsols2deg(a, b, c)@ that receives as argument the three coefficients of the 2nd degree equation and returns how many real solutions it has: 0, 1, or 2.
The solutions of that equation are given by the expression (best seen in the pdf version of the statement).
The expression is called its discriminant: if it is negative, then the square root cannot provide real values, and there are no real solutions; if the discriminant is 0, then the square root is also 0 and the two options coincide, so that there is a single real solution; if the discriminant is positive, then we obtain two real solutions.
>>> numsols2deg(3, 5, 2) 2 >>> numsols2deg(1, 2, 1) 1 >>> numsols2deg(1, 1, 1) 0 >>> numsols2deg(-2, 2, 2) 2