Let A and B each be random real numbers chosen from the uniform interval (0,1).
Call Z the tenths place digit of AB.
Find the probability distribution of Z.
The answer should fit this:
Three sets of randomized trials are as follows:
Z probability
0 0.0258100
1 0.0384200
2 0.0466800
3 0.0579100
4 0.0712300
5 0.0832800
6 0.1005900
7 0.1234000
8 0.1664400
9 0.2862400
0 0.0252700
1 0.0382500
2 0.0468700
3 0.0582500
4 0.0694800
5 0.0838100
6 0.1010700
7 0.1273600
8 0.1650100
9 0.2846300
0 0.0257200
1 0.0378300
2 0.0473800
3 0.0572500
4 0.0689100
5 0.0813900
6 0.1029900
7 0.1246100
8 0.1665400
9 0.2873800
Each of these sets is based on 100,000 random pairs of A and B.
from
DefDbl A-Z
Dim crlf$
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
Private Sub Form_Load()
ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
DoEvents
For overtrial = 1 To 3
Randomize Timer
ReDim digCt(9)
For trial = 1 To 100000
b = Rnd(1): x = Rnd(1)
p = b ^ x
ps = mform(p, "0.000000000")
' Text1.Text = Text1.Text & p & crlf
' DoEvents
d = Val(Mid(ps, 3, 1))
' Text1.Text = Text1.Text & p & " " & d & crlf
' DoEvents
digCt(d) = digCt(d) + 1
Next trial
For i = 0 To 9
Text1.Text = Text1.Text & i & mform(digCt(i) / (trial - 1), " 0.0000000") & crlf
Next
DoEvents
Text1.Text = Text1.Text & crlf
Next overtrial
Text1.Text = Text1.Text & crlf & "done"
End Sub
|
Posted by Charlie
on 2014-10-29 13:54:25 |