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.
(In reply to
towards an analytic solution by Charlie)
Actually that would be 1 - Integral{0 to 1} ln(.9)/ln(A) dA.
It comes out to 0.2870992757... (this is for digit 9) per the .9 in the formula.
via:
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
lp9 = Log(0.9)
n = 100000
For x = 1 / (2 * n) To 1 - 1 / (2 * n) Step 1 / n
tot = tot + Exp(lp9 / x)
Next
DoEvents
Text1.Text = Text1.Text & crlf
Text1.Text = Text1.Text & crlf
n = 100000
tot = 0
For x = 1 / (2 * n) To 1 - 1 / (2 * n) Step 1 / n
tot = tot + Exp(lp9 / x)
Next
Text1.Text = Text1.Text & x & " " & 1 - tot / n
Text1.Text = Text1.Text & crlf
Text1.Text = Text1.Text & crlf
n = 10000000
tot = 0
For x = 1 / (2 * n) To 1 - 1 / (2 * n) Step 1 / n
tot = tot + Exp(lp9 / x)
Next
Text1.Text = Text1.Text & x & " " & 1 - tot / n
Text1.Text = Text1.Text & crlf & "done"
End Sub
showing
0.28709927571142
0.287099275716361
as approximations using increments of 1/100,000 and 1/10,000,000 respectively.
|
Posted by Charlie
on 2014-10-29 15:32:44 |