Let us consider the quadratic equation: ax˛ + bx + c = 0.
We assign values to the coefficients a, b and c by throwing a die.
What is the probability that the equation will have real roots ?
(In reply to
solution by derek)
A program for doing this is:
DEFDBL A-Z
FOR a = 1 TO 6
FOR b = 1 TO 6
FOR c = 1 TO 6
IF b * b > 4 * a * c THEN
ct = ct + 1
ELSEIF b * b = 4 * a * c THEN
ct2 = ct2 + 1
END IF
NEXT
NEXT
NEXT
PRINT USING "##.########"; ct / (6 * 6 * 6); ct2 / (6 * 6 * 6); ct / (6 * 6 * 6) + ct2 / (6 * 6 * 6)
which counts separately the cases where there are two distinct real roots from those cases where there is a double root. The results come out:
0.17592593 0.02314815 0.19907407
so the 19.9% probability of real roots is broken down into a 17.6% probability of two distinct real roots and 2.3% probability of a double real root.
|
Posted by Charlie
on 2003-08-20 10:19:30 |