Die 1 is an unbiased and regular sixsided die numbered 1 to 6.
Die 2 is an unbiased and regular sevensided die numbered 2 to 8.
Die 3 is an unbiased and regular eight sided die numbered 3 to 10
Consider the quadratic equation Ax^{2}+Bx+C= 0.
We assign values to the coefficient A by throwing Die 1, the coefficient B by throwing Die 2 and the coefficient C by throwing Die 3.
Determine the probability that the equation will have real roots.
There are 52 cases of real roots out of the 336 possible combinations that are possible. (5 of the 52 cases are examples of double real roots)
The probability is therefore 52/336 = 13/84 ~= 0.154761904761905.
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For a = 1 To 6
For b = 2 To 8
For c = 3 To 10
disc = b * b  4 * a * c
If disc >= 0 Then
If disc = 0 Then dblCt = dblCt + 1
realCt = realCt + 1
End If
ct = ct + 1
Next
Next
Next
Text1.Text = Text1.Text & crlf & realCt & Str(ct) & " " & "(" & dblCt & ")"
Text1.Text = Text1.Text & crlf & realCt / ct & crlf
End Sub

Posted by Charlie
on 20160920 15:43:45 