SlideShare a Scribd company logo
In[31]:= A[k_, m_] = Gamma[m + 2] / Gamma[k + 1] / Gamma[m - k + 1];
(*expected value of x*)
xexp[k_, m_, n_] = A[k, m] / 2 *
NIntegrate[x^(m - k) * (1 - x)^k * (x * x^(1 - m + n) + (1 + x) * (1 - x^(1 - m + n))), {x, 0, 1}];
N[xexp[3, 37, 0, 100]]
NIntegrate: The integrand (1 - x)k
x-k+m
x2-m+n
+ (1 + x) 1 - x1+Times[2]+n
 has evaluated to non-numerical
values for all sampling points in the region with boundaries {{0, 1}}.
NIntegrate: The integrand (1 - x)k
x-k+m
x2-m+n
+ (1 + x) 1 - x1+Times[2]+n
 has evaluated to non-numerical
values for all sampling points in the region with boundaries {{0, 1}}.
Out[33]= 0.940033
In[27]:= Integrate[(n - m + 1) * y^(n - m), {y, 0, x}]
Out[27]= x1-m+n
if Re[m - n] < 1
(*now we need to adjust for the rate of being rejected*)
success[n_, m_, x_] = (1 - x^(1 - m + n));
failure[n_, m_, x_] = x^(1 - m + n);
(*r is the acceptance rate*)
(*the question we are asking
is: given that the greatest point in the test set is greater than x,
how many points are greater than x*)
(*we have to untangle success again*)
successold[n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m), {y, x, 1}];
(*now given y, we can set up the space between
x and y and compare it to the space below y itself*)
(*deprecated, see below*)
(*greaterx[n_,m_,x_]=Integrate[(n-m+1)*y^(n-m)*(y-x)/y*(n-m),{y,x,1}]*)
(*for each greater than x point y,
we find the number of points that are between x and y, then add them together*)
rejected[n_, m_, x_, r_] = success[n, m, x] * (1 - r)^(greaterx[n, m, x]);
notrejected[n_, m_, x_, r_] = success[n, m, x] * (1 - (1 - r)^(greaterx[n, m, x]));
xexp[k_, m_, n_, r_] =
A[k, m] / 2 * NIntegrate[x^(m - k) * (1 - x)^k * (x * (failure[n, m, x] + rejected[n, m, x, r]) +
(1 + x) * notrejected[n, m, x, r]), {x, 0, 1}];
Plot[N[success[100, 37, x]], {x, 0, 1}, PlotRange → {-0.1, 1}]
(*makes sense, if the first number is large, it's hard to beat it*)
Plot[N[rejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}]
Plot[N[notrejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}]
Out[169]=
-
(-m + n) (1 - m + n) m + n (-1 + x) + x - m x - x1-m+n

(-1 + m - n) (m - n)
if condition
NIntegrate: The integrand TagBox[TemplateBox[{RowBox[{SuperscriptBox[RowBox[{(, RowBox[{1, -, x}], )}], k],
, SuperscriptBox[x, RowBox[{RowBox[{-, k}], +, m}]],
, RowBox[{(, RowBox[{RowBox[{RowBox[{(, RowBox[{1, -, SuperscriptBox[RowBox[{Plus,
[, RowBox[{, 2, }], ]}], RowBox[{Times, [, RowBox[{, 6, }], ]}]]}],
)}], , RowBox[{(, RowBox[{1, +, x}], )}], , RowBox[{(, RowBox[{1,
-, SuperscriptBox[x, RowBox[{Plus, [, RowBox[{, 3, }], ]}]]}], )}]}],
+, RowBox[{x, , RowBox[{(, RowBox[{SuperscriptBox[x, RowBox[{1, +, RowBox[{Times,
[, RowBox[{, 2, }], ]}], +, n}]],
+, RowBox[{SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }],
]}], RowBox[{Times, [, RowBox[{, 6, }], ]}]],
, RowBox[{(, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}],
)}]}]}], )}]}]}],
)}]}], InterpretationBox[DynamicModuleBox[{Typeset`open = False}, TemplateBox[{
Expression, StyleBox[TagBox[TooltipBox[
"condition", RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{RowBox[{RowBox[{Re,
[, RowBox[{RowBox[{Power, [, RowBox[{, 2, }], ]}], ,
x}], ]}], ≥, 0}], &&, RowBox[{FractionBox[x, RowBox[{Plus,
[, RowBox[{, 2, }], ]}]], ≠, 0}]}], )}],
||, RowBox[{FractionBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{,
2, }], ]}]}]], ∉, TemplateBox[{}, Reals]}],
||, RowBox[{RowBox[{Re, [, FractionBox[x, RowBox[{Plus, [, RowBox[{, 2,
}], ]}]], ]}], <, RowBox[{-, 1}]}]}], )}],
&&, RowBox[{(, RowBox[{RowBox[{x, ∉, TemplateBox[{}, Reals]}],
||, RowBox[{RowBox[{Re, [, x, ]}], >, 1}], ||, RowBox[{0, <, RowBox[{Re, [,
x, ]}], <, 1}]}],
)}]}]], Annotation[#1, Short[((Re[Power[<< 2 >>]*x] >= 0 && x/(Plus[<< 2 >>
]) != 0) || NotElement[x/(1 + Times[<< 2 >>]), Reals] || Re[x/(
Plus[<< 2 >>])] < -1) && (NotElement[x, Reals] || Re[x] > 1 ||
Inequality[0, Less, Re[x], Less, 1]), 7],
Tooltip] &],
IconizedCustomName, StripOnInput -> False], GridBox[{{RowBox[{TagBox["Head: ",
IconizedLabel], , TagBox[And, IconizedItem]}]}, {RowBox[{TagBox["Byte count: ",
IconizedLabel], , TagBox[1904,
IconizedItem]}]}}, GridBoxAlignment -> {Columns -> {{Left}}}, DefaultBaseStyle ->
Column, GridBoxItemSize -> {Columns -> {{Automatic}},
Rows -> {{Automatic}}}], Dynamic[Typeset`open]},
IconizedObject]], ((Re[x*<< 2 >>] >= 0 && x/<< 2 >> != 0) || NotElement[x/(1 + << 2 >>),
Reals] || Re[x/<< 2 >>] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[
x], Less, 1]), SelectWithContents -> True, Selectable -> False]},
ConditionalExpression], Short[#1, 5] &] has evaluated to non-numerical values for all sampling points
in the region with boundaries {{0, 1}}.
2
NIntegrate: The integrand TagBox[TemplateBox[{RowBox[{SuperscriptBox[RowBox[{(, RowBox[{1, -, x}], )}], k],
, SuperscriptBox[x, RowBox[{RowBox[{-, k}], +, m}]],
, RowBox[{(, RowBox[{RowBox[{RowBox[{(, RowBox[{1, -, SuperscriptBox[RowBox[{Plus,
[, RowBox[{, 2, }], ]}], RowBox[{Times, [, RowBox[{, 6, }], ]}]]}],
)}], , RowBox[{(, RowBox[{1, +, x}], )}], , RowBox[{(, RowBox[{1,
-, SuperscriptBox[x, RowBox[{Plus, [, RowBox[{, 3, }], ]}]]}], )}]}],
+, RowBox[{x, , RowBox[{(, RowBox[{SuperscriptBox[x, RowBox[{1, +, RowBox[{Times,
[, RowBox[{, 2, }], ]}], +, n}]],
+, RowBox[{SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }],
]}], RowBox[{Times, [, RowBox[{, 6, }], ]}]],
, RowBox[{(, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}],
)}]}]}], )}]}]}],
)}]}], InterpretationBox[DynamicModuleBox[{Typeset`open = False}, TemplateBox[{
Expression, StyleBox[TagBox[TooltipBox[
"condition", RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{RowBox[{RowBox[{Re,
[, RowBox[{RowBox[{Power, [, RowBox[{, 2, }], ]}], ,
x}], ]}], ≥, 0}], &&, RowBox[{FractionBox[x, RowBox[{Plus,
[, RowBox[{, 2, }], ]}]], ≠, 0}]}], )}],
||, RowBox[{FractionBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{,
2, }], ]}]}]], ∉, TemplateBox[{}, Reals]}],
||, RowBox[{RowBox[{Re, [, FractionBox[x, RowBox[{Plus, [, RowBox[{, 2,
}], ]}]], ]}], <, RowBox[{-, 1}]}]}], )}],
&&, RowBox[{(, RowBox[{RowBox[{x, ∉, TemplateBox[{}, Reals]}],
||, RowBox[{RowBox[{Re, [, x, ]}], >, 1}], ||, RowBox[{0, <, RowBox[{Re, [,
x, ]}], <, 1}]}],
)}]}]], Annotation[#1, Short[((Re[Power[<< 2 >>]*x] >= 0 && x/(Plus[<< 2 >>
]) != 0) || NotElement[x/(1 + Times[<< 2 >>]), Reals] || Re[x/(
Plus[<< 2 >>])] < -1) && (NotElement[x, Reals] || Re[x] > 1 ||
Inequality[0, Less, Re[x], Less, 1]), 7],
Tooltip] &],
IconizedCustomName, StripOnInput -> False], GridBox[{{RowBox[{TagBox["Head: ",
IconizedLabel], , TagBox[And, IconizedItem]}]}, {RowBox[{TagBox["Byte count: ",
IconizedLabel], , TagBox[1904,
IconizedItem]}]}}, GridBoxAlignment -> {Columns -> {{Left}}}, DefaultBaseStyle ->
Column, GridBoxItemSize -> {Columns -> {{Automatic}},
Rows -> {{Automatic}}}], Dynamic[Typeset`open]},
IconizedObject]], ((Re[x*<< 2 >>] >= 0 && x/<< 2 >> != 0) || NotElement[x/(1 + << 2 >>),
Reals] || Re[x/<< 2 >>] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[
x], Less, 1]), SelectWithContents -> True, Selectable -> False]},
ConditionalExpression], Short[#1, 5] &] has evaluated to non-numerical values for all sampling points
in the region with boundaries {{0, 1}}.
3
Out[173]=
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
Out[174]=
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
Out[175]=
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
(*that looks much better!*)
4
In[140]:= Plot[xexp[k, 37, 100, 0.1], {k, 1, 15}]
Out[140]=
2 4 6 8 10 12 14
0.60
0.65
0.70
0.75
(*looks like 0.76 and only top 11 or so*)
In[141]:= Plot3D[xexp[k, m, 100, 0.1], {k, 1, 20}, {m, 1, 40}]
Out[141]=
(*it looks like it's telling me top 1 and fire after 4 trials*)
In[176]:= Quiet[FindMaximum[xexp[k, m, 100, 0.1], {k, 10}, {m, 37}]]
Out[176]=
{0.770144, {k → 11.2483, m → 35.5792}}
In[177]:= Quiet[FindMaximum[xexp[k, m, 100, 0.1], {k, 1}, {m, 4}]]
Out[177]=
{0.794735, {k → 3.64866, m → 14.252}}
In[179]:= Quiet[FindMaximum[{xexp[k, m, 100, 0.1], 1 ≤ k ≤ 15, 1 ≤ m ≤ 40}, {k, m}]]
Out[179]=
{0.794735, {k → 3.64867, m → 14.252}}
5
(*seems like there could be other local maxima but the global one is at k=
3.65 and m = 14.3*)
In[180]:= Quiet[FindMaximum[{xexp[k, m, 1000, 0.1], 1 ≤ k ≤ 50, 1 ≤ m ≤ 400}, {k, m}]]
Out[180]=
{0.962388, {k → 9.65589, m → 171.697}}
In[184]:= Quiet[FindMaximum[{xexp[k, m, 10 000, 0.1], 10 ≤ k ≤ 50, 1000 ≤ m ≤ 2000}, {k, m}]]
Out[184]=
{0., {k → 19.2022, m → 1085.2}}
(*and then it just broke*)
In[185]:= Quiet[FindMaximum[{xexp[k, m, 200, 0.1], 1 ≤ k ≤ 15, 1 ≤ m ≤ 40}, {k, m}]]
Out[185]=
{0.871543, {k → 5.4209, m → 31.5675}}
In[188]:= Quiet[FindMaximum[{xexp[k, m, 300, 0.1], 1 ≤ k ≤ 15, 1 ≤ m ≤ 60}, {k, m}]]
Out[188]=
{0.904275, {k → 6.48495, m → 48.9963}}
(*another thing to consider is that (1-r)^(greaterx[n,m,x]) is log-normal,
not normal*)
In[191]:= greaterx["mean"][n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m) * (y - x) / y * (n - m), {y, x, 1}]
greaterx["var"][n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m) * (y - x) / y * x / y * (n - m), {y, x, 1}]
Out[191]=
-
(-m + n) (1 - m + n) m + n (-1 + x) + x - m x - x1-m+n

(-1 + m - n) (m - n)
if condition
Out[192]=
-
(-m + n) (1 - m + n) x 1 + m + n (-1 + x) - m x - x-m+n

(m - n) (1 + m - n)
if condition
In[197]:= (*I need the mean of (1-r)^(Gaussian) - it's mu + var/2. aside: we have ln[term]=
log(1-r)*Gaussian, this factor doesn't influence mean or std*)
greaterx[n_, m_, x_] = greaterx["mean"][n, m, x] + greaterx["var"][n, m, x] / 2
Out[197]=
-
(-m + n) (1 - m + n) x 1 + m + n (-1 + x) - m x - x-m+n

2 (m - n) (1 + m - n)
-
(-m + n) (1 - m + n) m + n (-1 + x) + x - m x - x1-m+n

(-1 + m - n) (m - n)
if condition
6
In[198]:= rejected[n_, m_, x_, r_] = success[n, m, x] * (1 - r)^(greaterx[n, m, x]);
notrejected[n_, m_, x_, r_] = success[n, m, x] * (1 - (1 - r)^(greaterx[n, m, x]));
xexp[k_, m_, n_, r_] =
A[k, m] / 2 * NIntegrate[x^(m - k) * (1 - x)^k * (x * (failure[n, m, x] + rejected[n, m, x, r]) +
(1 + x) * notrejected[n, m, x, r]), {x, 0, 1}];
Plot[N[success[100, 37, x]], {x, 0, 1}, PlotRange → {-0.1, 1}]
(*makes sense, if the first number is large, it's hard to beat it*)
Plot[N[rejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}]
Plot[N[notrejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}]
NIntegrate: The integrand TagBox[TemplateBox[{RowBox[{SuperscriptBox[RowBox[{(, RowBox[{1, -, x}], )}], k],
, SuperscriptBox[x, RowBox[{RowBox[{-, k}], +, m}]],
, RowBox[{(, RowBox[{RowBox[{RowBox[{(, RowBox[{1, -, SuperscriptBox[RowBox[{Plus,
[, RowBox[{, 2, }], ]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]]}],
)}], , RowBox[{(, RowBox[{1, +, x}], )}], , RowBox[{(, RowBox[{1,
-, SuperscriptBox[x, RowBox[{Plus, [, RowBox[{, 3, }], ]}]]}], )}]}],
+, RowBox[{x, , RowBox[{(, RowBox[{SuperscriptBox[x, RowBox[{1, +, RowBox[{Times,
[, RowBox[{, 2, }], ]}], +, n}]],
+, RowBox[{SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }],
]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]],
, RowBox[{(, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}],
)}]}]}], )}]}]}],
)}]}], InterpretationBox[DynamicModuleBox[{Typeset`open = False}, TemplateBox[{
Expression, StyleBox[TagBox[TooltipBox[
"condition", RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{RowBox[{RowBox[{Re,
[, RowBox[{RowBox[{Power, [, RowBox[{, 2, }], ]}], ,
x}], ]}], ≥, 0}], &&, RowBox[{FractionBox[x, RowBox[{Plus,
[, RowBox[{, 2, }], ]}]], ≠, 0}]}], )}],
||, RowBox[{FractionBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{,
2, }], ]}]}]], ∉, TemplateBox[{}, Reals]}],
||, RowBox[{RowBox[{Re, [, FractionBox[x, RowBox[{Plus, [, RowBox[{, 2,
}], ]}]], ]}], <, RowBox[{-, 1}]}]}], )}],
&&, RowBox[{(, RowBox[{RowBox[{x, ∉, TemplateBox[{}, Reals]}],
||, RowBox[{RowBox[{Re, [, x, ]}], >, 1}], ||, RowBox[{0, <, RowBox[{Re, [,
x, ]}], <, 1}]}],
)}]}]], Annotation[#1, Short[((Re[Power[<< 2 >>]*x] >= 0 && x/(Plus[<< 2 >>
]) != 0) || NotElement[x/(1 + Times[<< 2 >>]), Reals] || Re[x/(
Plus[<< 2 >>])] < -1) && (NotElement[x, Reals] || Re[x] > 1 ||
Inequality[0, Less, Re[x], Less, 1]), 7],
Tooltip] &],
IconizedCustomName, StripOnInput -> False], GridBox[{{RowBox[{TagBox["Head: ",
IconizedLabel], , TagBox[And, IconizedItem]}]}, {RowBox[{TagBox["Byte count: ",
IconizedLabel], , TagBox[1904,
IconizedItem]}]}}, GridBoxAlignment -> {Columns -> {{Left}}}, DefaultBaseStyle ->
Column, GridBoxItemSize -> {Columns -> {{Automatic}},
Rows -> {{Automatic}}}], Dynamic[Typeset`open]},
IconizedObject]], ((Re[x*<< 2 >>] >= 0 && x/<< 2 >> != 0) || NotElement[x/(1 + << 2 >>),
Reals] || Re[x/<< 2 >>] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[
x], Less, 1]), SelectWithContents -> True, Selectable -> False]},
ConditionalExpression], Short[#1, 5] &] has evaluated to non-numerical values for all sampling points
in the region with boundaries {{0, 1}}.
7
NIntegrate: The integrand TagBox[TemplateBox[{RowBox[{SuperscriptBox[RowBox[{(, RowBox[{1, -, x}], )}], k],
, SuperscriptBox[x, RowBox[{RowBox[{-, k}], +, m}]],
, RowBox[{(, RowBox[{RowBox[{RowBox[{(, RowBox[{1, -, SuperscriptBox[RowBox[{Plus,
[, RowBox[{, 2, }], ]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]]}],
)}], , RowBox[{(, RowBox[{1, +, x}], )}], , RowBox[{(, RowBox[{1,
-, SuperscriptBox[x, RowBox[{Plus, [, RowBox[{, 3, }], ]}]]}], )}]}],
+, RowBox[{x, , RowBox[{(, RowBox[{SuperscriptBox[x, RowBox[{1, +, RowBox[{Times,
[, RowBox[{, 2, }], ]}], +, n}]],
+, RowBox[{SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }],
]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]],
, RowBox[{(, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}],
)}]}]}], )}]}]}],
)}]}], InterpretationBox[DynamicModuleBox[{Typeset`open = False}, TemplateBox[{
Expression, StyleBox[TagBox[TooltipBox[
"condition", RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{RowBox[{RowBox[{Re,
[, RowBox[{RowBox[{Power, [, RowBox[{, 2, }], ]}], ,
x}], ]}], ≥, 0}], &&, RowBox[{FractionBox[x, RowBox[{Plus,
[, RowBox[{, 2, }], ]}]], ≠, 0}]}], )}],
||, RowBox[{FractionBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{,
2, }], ]}]}]], ∉, TemplateBox[{}, Reals]}],
||, RowBox[{RowBox[{Re, [, FractionBox[x, RowBox[{Plus, [, RowBox[{, 2,
}], ]}]], ]}], <, RowBox[{-, 1}]}]}], )}],
&&, RowBox[{(, RowBox[{RowBox[{x, ∉, TemplateBox[{}, Reals]}],
||, RowBox[{RowBox[{Re, [, x, ]}], >, 1}], ||, RowBox[{0, <, RowBox[{Re, [,
x, ]}], <, 1}]}],
)}]}]], Annotation[#1, Short[((Re[Power[<< 2 >>]*x] >= 0 && x/(Plus[<< 2 >>
]) != 0) || NotElement[x/(1 + Times[<< 2 >>]), Reals] || Re[x/(
Plus[<< 2 >>])] < -1) && (NotElement[x, Reals] || Re[x] > 1 ||
Inequality[0, Less, Re[x], Less, 1]), 7],
Tooltip] &],
IconizedCustomName, StripOnInput -> False], GridBox[{{RowBox[{TagBox["Head: ",
IconizedLabel], , TagBox[And, IconizedItem]}]}, {RowBox[{TagBox["Byte count: ",
IconizedLabel], , TagBox[1904,
IconizedItem]}]}}, GridBoxAlignment -> {Columns -> {{Left}}}, DefaultBaseStyle ->
Column, GridBoxItemSize -> {Columns -> {{Automatic}},
Rows -> {{Automatic}}}], Dynamic[Typeset`open]},
IconizedObject]], ((Re[x*<< 2 >>] >= 0 && x/<< 2 >> != 0) || NotElement[x/(1 + << 2 >>),
Reals] || Re[x/<< 2 >>] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[
x], Less, 1]), SelectWithContents -> True, Selectable -> False]},
ConditionalExpression], Short[#1, 5] &] has evaluated to non-numerical values for all sampling points
in the region with boundaries {{0, 1}}.
8
Out[201]=
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
Out[202]=
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
Out[203]=
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
9
In[205]:= greaterxOld[n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m) * (y - x) / y * (n - m), {y, x, 1}]
rejectedOld[n_, m_, x_, r_] = success[n, m, x] * (1 - r)^(greaterxOld[n, m, x]);
Quiet[Plot[N[rejectedOld[100, 37, x, 0.1] - rejected[100, 37, x, 0.1]],
{x, 0, 1}, PlotRange → {-0.1, 1}]]
Out[205]=
-
(-m + n) (1 - m + n) m + n (-1 + x) + x - m x - x1-m+n

(-1 + m - n) (m - n)
if condition
Out[207]=
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
(*that's good news, we don't reject as many as we thought*)
In[242]:= (*all code together*)
success[n_, m_, x_] = (1 - x^(1 - m + n));
failure[n_, m_, x_] = x^(1 - m + n);
greaterx["mean"][n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m) * (y - x) / y * (n - m), {y, x, 1}];
greaterx["var"][n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m) * (y - x) / y * x / y * (n - m), {y, x, 1}];
greaterx[n_, m_, x_] = greaterx["mean"][n, m, x] + greaterx["var"][n, m, x] / 2;
(*r is the acceptance rate*)
rejected[n_, m_, x_, r_] = success[n, m, x] * (1 - r)^(greaterx[n, m, x]);
(*the rejection rate is log-normally distributed, so long tail warning*)
notrejected[n_, m_, x_, r_] = success[n, m, x] * (1 - (1 - r)^(greaterx[n, m, x]));
xexp[k_, m_, n_, r_] =
A[k, m] / 2 * NIntegrate[x^(m - k) * (1 - x)^k * (x * (failure[n, m, x] + rejected[n, m, x, r]) +
(1 + x) * notrejected[n, m, x, r]), {x, 0, 1}];
Quiet[Plot[N[success[100, 37, x]], {x, 0, 1}, PlotRange → {-0.1, 1}]]
Quiet[Plot[N[rejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}]]
Quiet[Plot[N[notrejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}]]
10
NIntegrate: The integrand TagBox[TemplateBox[{RowBox[{SuperscriptBox[RowBox[{(, RowBox[{1, -, x}], )}], k],
, SuperscriptBox[x, RowBox[{RowBox[{-, k}], +, m}]],
, RowBox[{(, RowBox[{RowBox[{RowBox[{(, RowBox[{1, -, SuperscriptBox[RowBox[{Plus,
[, RowBox[{, 2, }], ]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]]}],
)}], , RowBox[{(, RowBox[{1, +, x}], )}], , RowBox[{(, RowBox[{1,
-, SuperscriptBox[x, RowBox[{Plus, [, RowBox[{, 3, }], ]}]]}], )}]}],
+, RowBox[{x, , RowBox[{(, RowBox[{SuperscriptBox[x, RowBox[{1, +, RowBox[{Times,
[, RowBox[{, 2, }], ]}], +, n}]],
+, RowBox[{SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }],
]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]],
, RowBox[{(, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}],
)}]}]}], )}]}]}],
)}]}], InterpretationBox[DynamicModuleBox[{Typeset`open = False}, TemplateBox[{
Expression, StyleBox[TagBox[TooltipBox[
"condition", RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{RowBox[{RowBox[{Re,
[, RowBox[{RowBox[{Power, [, RowBox[{, 2, }], ]}], ,
x}], ]}], ≥, 0}], &&, RowBox[{FractionBox[x, RowBox[{Plus,
[, RowBox[{, 2, }], ]}]], ≠, 0}]}], )}],
||, RowBox[{FractionBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{,
2, }], ]}]}]], ∉, TemplateBox[{}, Reals]}],
||, RowBox[{RowBox[{Re, [, FractionBox[x, RowBox[{Plus, [, RowBox[{, 2,
}], ]}]], ]}], <, RowBox[{-, 1}]}]}], )}],
&&, RowBox[{(, RowBox[{RowBox[{x, ∉, TemplateBox[{}, Reals]}],
||, RowBox[{RowBox[{Re, [, x, ]}], >, 1}], ||, RowBox[{0, <, RowBox[{Re, [,
x, ]}], <, 1}]}],
)}]}]], Annotation[#1, Short[((Re[Power[<< 2 >>]*x] >= 0 && x/(Plus[<< 2 >>
]) != 0) || NotElement[x/(1 + Times[<< 2 >>]), Reals] || Re[x/(
Plus[<< 2 >>])] < -1) && (NotElement[x, Reals] || Re[x] > 1 ||
Inequality[0, Less, Re[x], Less, 1]), 7],
Tooltip] &],
IconizedCustomName, StripOnInput -> False], GridBox[{{RowBox[{TagBox["Head: ",
IconizedLabel], , TagBox[And, IconizedItem]}]}, {RowBox[{TagBox["Byte count: ",
IconizedLabel], , TagBox[1904,
IconizedItem]}]}}, GridBoxAlignment -> {Columns -> {{Left}}}, DefaultBaseStyle ->
Column, GridBoxItemSize -> {Columns -> {{Automatic}},
Rows -> {{Automatic}}}], Dynamic[Typeset`open]},
IconizedObject]], ((Re[x*<< 2 >>] >= 0 && x/<< 2 >> != 0) || NotElement[x/(1 + << 2 >>),
Reals] || Re[x/<< 2 >>] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[
x], Less, 1]), SelectWithContents -> True, Selectable -> False]},
ConditionalExpression], Short[#1, 5] &] has evaluated to non-numerical values for all sampling points
in the region with boundaries {{0, 1}}.
11
NIntegrate: The integrand TagBox[TemplateBox[{RowBox[{SuperscriptBox[RowBox[{(, RowBox[{1, -, x}], )}], k],
, SuperscriptBox[x, RowBox[{RowBox[{-, k}], +, m}]],
, RowBox[{(, RowBox[{RowBox[{RowBox[{(, RowBox[{1, -, SuperscriptBox[RowBox[{Plus,
[, RowBox[{, 2, }], ]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]]}],
)}], , RowBox[{(, RowBox[{1, +, x}], )}], , RowBox[{(, RowBox[{1,
-, SuperscriptBox[x, RowBox[{Plus, [, RowBox[{, 3, }], ]}]]}], )}]}],
+, RowBox[{x, , RowBox[{(, RowBox[{SuperscriptBox[x, RowBox[{1, +, RowBox[{Times,
[, RowBox[{, 2, }], ]}], +, n}]],
+, RowBox[{SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }],
]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]],
, RowBox[{(, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}],
)}]}]}], )}]}]}],
)}]}], InterpretationBox[DynamicModuleBox[{Typeset`open = False}, TemplateBox[{
Expression, StyleBox[TagBox[TooltipBox[
"condition", RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{RowBox[{RowBox[{Re,
[, RowBox[{RowBox[{Power, [, RowBox[{, 2, }], ]}], ,
x}], ]}], ≥, 0}], &&, RowBox[{FractionBox[x, RowBox[{Plus,
[, RowBox[{, 2, }], ]}]], ≠, 0}]}], )}],
||, RowBox[{FractionBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{,
2, }], ]}]}]], ∉, TemplateBox[{}, Reals]}],
||, RowBox[{RowBox[{Re, [, FractionBox[x, RowBox[{Plus, [, RowBox[{, 2,
}], ]}]], ]}], <, RowBox[{-, 1}]}]}], )}],
&&, RowBox[{(, RowBox[{RowBox[{x, ∉, TemplateBox[{}, Reals]}],
||, RowBox[{RowBox[{Re, [, x, ]}], >, 1}], ||, RowBox[{0, <, RowBox[{Re, [,
x, ]}], <, 1}]}],
)}]}]], Annotation[#1, Short[((Re[Power[<< 2 >>]*x] >= 0 && x/(Plus[<< 2 >>
]) != 0) || NotElement[x/(1 + Times[<< 2 >>]), Reals] || Re[x/(
Plus[<< 2 >>])] < -1) && (NotElement[x, Reals] || Re[x] > 1 ||
Inequality[0, Less, Re[x], Less, 1]), 7],
Tooltip] &],
IconizedCustomName, StripOnInput -> False], GridBox[{{RowBox[{TagBox["Head: ",
IconizedLabel], , TagBox[And, IconizedItem]}]}, {RowBox[{TagBox["Byte count: ",
IconizedLabel], , TagBox[1904,
IconizedItem]}]}}, GridBoxAlignment -> {Columns -> {{Left}}}, DefaultBaseStyle ->
Column, GridBoxItemSize -> {Columns -> {{Automatic}},
Rows -> {{Automatic}}}], Dynamic[Typeset`open]},
IconizedObject]], ((Re[x*<< 2 >>] >= 0 && x/<< 2 >> != 0) || NotElement[x/(1 + << 2 >>),
Reals] || Re[x/<< 2 >>] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[
x], Less, 1]), SelectWithContents -> True, Selectable -> False]},
ConditionalExpression], Short[#1, 5] &] has evaluated to non-numerical values for all sampling points
in the region with boundaries {{0, 1}}.
12
Out[250]=
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
Out[251]=
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
Out[252]=
0.2 0.4 0.6 0.8 1.0
0.2
0.4
0.6
0.8
1.0
In[241]:= Quiet[FindMaximum[xexp[k, m, 100, 0.1], {k, 1}, {m, 4}]]
Out[241]=
{0.828168, {k → 3.5195, m → 16.5013}}
13
(*so the median person has it considerably worse than the mean person -
which one am I*)
(*I think I am the mean person. The reason is that the log-
normal distribution gets integrated over all outcomes of the first trial-
phase so that means it becomes Gaussian again
due to the Central Limit Theorem - am I wrong?*)
14

More Related Content

Similar to Secretary_Game_With_Rejection.pdf

数式処理ソフトMathematicaで数学の問題を解く
数式処理ソフトMathematicaで数学の問題を解く数式処理ソフトMathematicaで数学の問題を解く
数式処理ソフトMathematicaで数学の問題を解く
Yoshihiro Mizoguchi
 
Computation in Real Closed Infinitesimal and Transcendental Extensions of the...
Computation in Real Closed Infinitesimal and Transcendental Extensions of the...Computation in Real Closed Infinitesimal and Transcendental Extensions of the...
Computation in Real Closed Infinitesimal and Transcendental Extensions of the...
TawseefAhmad25
 
CLUSTERGRAM
CLUSTERGRAMCLUSTERGRAM
CLUSTERGRAM
Dr. Volkan OBAN
 
PMHMathematicaSample
PMHMathematicaSamplePMHMathematicaSample
PMHMathematicaSample
Peter Hammel
 
Least Squares, Lasso, Ridge and ElasticNet
Least Squares, Lasso, Ridge and ElasticNetLeast Squares, Lasso, Ridge and ElasticNet
Least Squares, Lasso, Ridge and ElasticNet
Hossam Karim
 
BUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdfBUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdf
karthikaparthasarath
 
Modul 3 quadratic function
Modul 3 quadratic functionModul 3 quadratic function
Modul 3 quadratic function
Hafidz Mukhtar
 
Econometric Analysis 8th Edition Greene Solutions Manual
Econometric Analysis 8th Edition Greene Solutions ManualEconometric Analysis 8th Edition Greene Solutions Manual
Econometric Analysis 8th Edition Greene Solutions Manual
LewisSimmonss
 
Storyboard math
Storyboard mathStoryboard math
Storyboard math
shandex
 
Javascript Array map method
Javascript Array map methodJavascript Array map method
Javascript Array map method
tanerochris
 
Interpolation functions
Interpolation functionsInterpolation functions
Interpolation functions
Tarun Gehlot
 
ejercicio 140 libro de baldor resuelto
ejercicio 140 libro de baldor resueltoejercicio 140 libro de baldor resuelto
ejercicio 140 libro de baldor resuelto
Ivan Lobato Baltazar
 
Groovy Refactoring Patterns
Groovy Refactoring PatternsGroovy Refactoring Patterns
Groovy Refactoring Patterns
Naresha K
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
ikdysfm
 
ゲーム理論BASIC 第42回 -仁に関する定理の証明3-
ゲーム理論BASIC 第42回 -仁に関する定理の証明3-ゲーム理論BASIC 第42回 -仁に関する定理の証明3-
ゲーム理論BASIC 第42回 -仁に関する定理の証明3-
ssusere0a682
 
The Ring programming language version 1.10 book - Part 33 of 212
The Ring programming language version 1.10 book - Part 33 of 212The Ring programming language version 1.10 book - Part 33 of 212
The Ring programming language version 1.10 book - Part 33 of 212
Mahmoud Samir Fayed
 
Clustering and Factorization using Apache SystemML by Alexandre V Evfimievski
Clustering and Factorization using Apache SystemML by  Alexandre V EvfimievskiClustering and Factorization using Apache SystemML by  Alexandre V Evfimievski
Clustering and Factorization using Apache SystemML by Alexandre V Evfimievski
Arvind Surve
 
Clustering and Factorization using Apache SystemML by Alexandre V Evfimievski
Clustering and Factorization using Apache SystemML by  Alexandre V EvfimievskiClustering and Factorization using Apache SystemML by  Alexandre V Evfimievski
Clustering and Factorization using Apache SystemML by Alexandre V Evfimievski
Arvind Surve
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4
Roziq Bahtiar
 
some important questions for practice clas 12
some important questions for practice clas 12  some important questions for practice clas 12
some important questions for practice clas 12
nitishguptamaps
 

Similar to Secretary_Game_With_Rejection.pdf (20)

数式処理ソフトMathematicaで数学の問題を解く
数式処理ソフトMathematicaで数学の問題を解く数式処理ソフトMathematicaで数学の問題を解く
数式処理ソフトMathematicaで数学の問題を解く
 
Computation in Real Closed Infinitesimal and Transcendental Extensions of the...
Computation in Real Closed Infinitesimal and Transcendental Extensions of the...Computation in Real Closed Infinitesimal and Transcendental Extensions of the...
Computation in Real Closed Infinitesimal and Transcendental Extensions of the...
 
CLUSTERGRAM
CLUSTERGRAMCLUSTERGRAM
CLUSTERGRAM
 
PMHMathematicaSample
PMHMathematicaSamplePMHMathematicaSample
PMHMathematicaSample
 
Least Squares, Lasso, Ridge and ElasticNet
Least Squares, Lasso, Ridge and ElasticNetLeast Squares, Lasso, Ridge and ElasticNet
Least Squares, Lasso, Ridge and ElasticNet
 
BUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdfBUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdf
 
Modul 3 quadratic function
Modul 3 quadratic functionModul 3 quadratic function
Modul 3 quadratic function
 
Econometric Analysis 8th Edition Greene Solutions Manual
Econometric Analysis 8th Edition Greene Solutions ManualEconometric Analysis 8th Edition Greene Solutions Manual
Econometric Analysis 8th Edition Greene Solutions Manual
 
Storyboard math
Storyboard mathStoryboard math
Storyboard math
 
Javascript Array map method
Javascript Array map methodJavascript Array map method
Javascript Array map method
 
Interpolation functions
Interpolation functionsInterpolation functions
Interpolation functions
 
ejercicio 140 libro de baldor resuelto
ejercicio 140 libro de baldor resueltoejercicio 140 libro de baldor resuelto
ejercicio 140 libro de baldor resuelto
 
Groovy Refactoring Patterns
Groovy Refactoring PatternsGroovy Refactoring Patterns
Groovy Refactoring Patterns
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
ゲーム理論BASIC 第42回 -仁に関する定理の証明3-
ゲーム理論BASIC 第42回 -仁に関する定理の証明3-ゲーム理論BASIC 第42回 -仁に関する定理の証明3-
ゲーム理論BASIC 第42回 -仁に関する定理の証明3-
 
The Ring programming language version 1.10 book - Part 33 of 212
The Ring programming language version 1.10 book - Part 33 of 212The Ring programming language version 1.10 book - Part 33 of 212
The Ring programming language version 1.10 book - Part 33 of 212
 
Clustering and Factorization using Apache SystemML by Alexandre V Evfimievski
Clustering and Factorization using Apache SystemML by  Alexandre V EvfimievskiClustering and Factorization using Apache SystemML by  Alexandre V Evfimievski
Clustering and Factorization using Apache SystemML by Alexandre V Evfimievski
 
Clustering and Factorization using Apache SystemML by Alexandre V Evfimievski
Clustering and Factorization using Apache SystemML by  Alexandre V EvfimievskiClustering and Factorization using Apache SystemML by  Alexandre V Evfimievski
Clustering and Factorization using Apache SystemML by Alexandre V Evfimievski
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4
 
some important questions for practice clas 12
some important questions for practice clas 12  some important questions for practice clas 12
some important questions for practice clas 12
 

Recently uploaded

Salesforce AI + Data Community Tour Slides - Canarias
Salesforce AI + Data Community Tour Slides - CanariasSalesforce AI + Data Community Tour Slides - Canarias
Salesforce AI + Data Community Tour Slides - Canarias
davidpietrzykowski1
 
一比一原版莱斯大学毕业证(rice毕业证)如何办理
一比一原版莱斯大学毕业证(rice毕业证)如何办理一比一原版莱斯大学毕业证(rice毕业证)如何办理
一比一原版莱斯大学毕业证(rice毕业证)如何办理
zsafxbf
 
Sample Devops SRE Product Companies .pdf
Sample Devops SRE  Product Companies .pdfSample Devops SRE  Product Companies .pdf
Sample Devops SRE Product Companies .pdf
Vineet
 
Overview IFM June 2024 Consumer Confidence INDEX Report.pdf
Overview IFM June 2024 Consumer Confidence INDEX Report.pdfOverview IFM June 2024 Consumer Confidence INDEX Report.pdf
Overview IFM June 2024 Consumer Confidence INDEX Report.pdf
nhutnguyen355078
 
Senior Engineering Sample EM DOE - Sheet1.pdf
Senior Engineering Sample EM DOE  - Sheet1.pdfSenior Engineering Sample EM DOE  - Sheet1.pdf
Senior Engineering Sample EM DOE - Sheet1.pdf
Vineet
 
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
z6osjkqvd
 
How To Control IO Usage using Resource Manager
How To Control IO Usage using Resource ManagerHow To Control IO Usage using Resource Manager
How To Control IO Usage using Resource Manager
Alireza Kamrani
 
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
hqfek
 
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
aguty
 
一比一原版卡尔加里大学毕业证(uc毕业证)如何办理
一比一原版卡尔加里大学毕业证(uc毕业证)如何办理一比一原版卡尔加里大学毕业证(uc毕业证)如何办理
一比一原版卡尔加里大学毕业证(uc毕业证)如何办理
oaxefes
 
Sid Sigma educational and problem solving power point- Six Sigma.ppt
Sid Sigma educational and problem solving power point- Six Sigma.pptSid Sigma educational and problem solving power point- Six Sigma.ppt
Sid Sigma educational and problem solving power point- Six Sigma.ppt
ArshadAyub49
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
bmucuha
 
一比一原版马来西亚博特拉大学毕业证(upm毕业证)如何办理
一比一原版马来西亚博特拉大学毕业证(upm毕业证)如何办理一比一原版马来西亚博特拉大学毕业证(upm毕业证)如何办理
一比一原版马来西亚博特拉大学毕业证(upm毕业证)如何办理
eudsoh
 
Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...
Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...
Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...
Marlon Dumas
 
Data Scientist Machine Learning Profiles .pdf
Data Scientist Machine Learning  Profiles .pdfData Scientist Machine Learning  Profiles .pdf
Data Scientist Machine Learning Profiles .pdf
Vineet
 
Econ3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdfEcon3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdf
blueshagoo1
 
一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理
一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理
一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理
actyx
 
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
nyvan3
 
Telemetry Solution for Gaming (AWS Summit'24)
Telemetry Solution for Gaming (AWS Summit'24)Telemetry Solution for Gaming (AWS Summit'24)
Telemetry Solution for Gaming (AWS Summit'24)
GeorgiiSteshenko
 
Build applications with generative AI on Google Cloud
Build applications with generative AI on Google CloudBuild applications with generative AI on Google Cloud
Build applications with generative AI on Google Cloud
Márton Kodok
 

Recently uploaded (20)

Salesforce AI + Data Community Tour Slides - Canarias
Salesforce AI + Data Community Tour Slides - CanariasSalesforce AI + Data Community Tour Slides - Canarias
Salesforce AI + Data Community Tour Slides - Canarias
 
一比一原版莱斯大学毕业证(rice毕业证)如何办理
一比一原版莱斯大学毕业证(rice毕业证)如何办理一比一原版莱斯大学毕业证(rice毕业证)如何办理
一比一原版莱斯大学毕业证(rice毕业证)如何办理
 
Sample Devops SRE Product Companies .pdf
Sample Devops SRE  Product Companies .pdfSample Devops SRE  Product Companies .pdf
Sample Devops SRE Product Companies .pdf
 
Overview IFM June 2024 Consumer Confidence INDEX Report.pdf
Overview IFM June 2024 Consumer Confidence INDEX Report.pdfOverview IFM June 2024 Consumer Confidence INDEX Report.pdf
Overview IFM June 2024 Consumer Confidence INDEX Report.pdf
 
Senior Engineering Sample EM DOE - Sheet1.pdf
Senior Engineering Sample EM DOE  - Sheet1.pdfSenior Engineering Sample EM DOE  - Sheet1.pdf
Senior Engineering Sample EM DOE - Sheet1.pdf
 
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
 
How To Control IO Usage using Resource Manager
How To Control IO Usage using Resource ManagerHow To Control IO Usage using Resource Manager
How To Control IO Usage using Resource Manager
 
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
 
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
 
一比一原版卡尔加里大学毕业证(uc毕业证)如何办理
一比一原版卡尔加里大学毕业证(uc毕业证)如何办理一比一原版卡尔加里大学毕业证(uc毕业证)如何办理
一比一原版卡尔加里大学毕业证(uc毕业证)如何办理
 
Sid Sigma educational and problem solving power point- Six Sigma.ppt
Sid Sigma educational and problem solving power point- Six Sigma.pptSid Sigma educational and problem solving power point- Six Sigma.ppt
Sid Sigma educational and problem solving power point- Six Sigma.ppt
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
一比一原版马来西亚博特拉大学毕业证(upm毕业证)如何办理
一比一原版马来西亚博特拉大学毕业证(upm毕业证)如何办理一比一原版马来西亚博特拉大学毕业证(upm毕业证)如何办理
一比一原版马来西亚博特拉大学毕业证(upm毕业证)如何办理
 
Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...
Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...
Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...
 
Data Scientist Machine Learning Profiles .pdf
Data Scientist Machine Learning  Profiles .pdfData Scientist Machine Learning  Profiles .pdf
Data Scientist Machine Learning Profiles .pdf
 
Econ3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdfEcon3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdf
 
一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理
一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理
一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理
 
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
 
Telemetry Solution for Gaming (AWS Summit'24)
Telemetry Solution for Gaming (AWS Summit'24)Telemetry Solution for Gaming (AWS Summit'24)
Telemetry Solution for Gaming (AWS Summit'24)
 
Build applications with generative AI on Google Cloud
Build applications with generative AI on Google CloudBuild applications with generative AI on Google Cloud
Build applications with generative AI on Google Cloud
 

Secretary_Game_With_Rejection.pdf

  • 1. In[31]:= A[k_, m_] = Gamma[m + 2] / Gamma[k + 1] / Gamma[m - k + 1]; (*expected value of x*) xexp[k_, m_, n_] = A[k, m] / 2 * NIntegrate[x^(m - k) * (1 - x)^k * (x * x^(1 - m + n) + (1 + x) * (1 - x^(1 - m + n))), {x, 0, 1}]; N[xexp[3, 37, 0, 100]] NIntegrate: The integrand (1 - x)k x-k+m x2-m+n + (1 + x) 1 - x1+Times[2]+n  has evaluated to non-numerical values for all sampling points in the region with boundaries {{0, 1}}. NIntegrate: The integrand (1 - x)k x-k+m x2-m+n + (1 + x) 1 - x1+Times[2]+n  has evaluated to non-numerical values for all sampling points in the region with boundaries {{0, 1}}. Out[33]= 0.940033 In[27]:= Integrate[(n - m + 1) * y^(n - m), {y, 0, x}] Out[27]= x1-m+n if Re[m - n] < 1 (*now we need to adjust for the rate of being rejected*) success[n_, m_, x_] = (1 - x^(1 - m + n)); failure[n_, m_, x_] = x^(1 - m + n); (*r is the acceptance rate*) (*the question we are asking is: given that the greatest point in the test set is greater than x, how many points are greater than x*) (*we have to untangle success again*) successold[n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m), {y, x, 1}]; (*now given y, we can set up the space between x and y and compare it to the space below y itself*) (*deprecated, see below*) (*greaterx[n_,m_,x_]=Integrate[(n-m+1)*y^(n-m)*(y-x)/y*(n-m),{y,x,1}]*) (*for each greater than x point y, we find the number of points that are between x and y, then add them together*) rejected[n_, m_, x_, r_] = success[n, m, x] * (1 - r)^(greaterx[n, m, x]); notrejected[n_, m_, x_, r_] = success[n, m, x] * (1 - (1 - r)^(greaterx[n, m, x])); xexp[k_, m_, n_, r_] = A[k, m] / 2 * NIntegrate[x^(m - k) * (1 - x)^k * (x * (failure[n, m, x] + rejected[n, m, x, r]) + (1 + x) * notrejected[n, m, x, r]), {x, 0, 1}]; Plot[N[success[100, 37, x]], {x, 0, 1}, PlotRange → {-0.1, 1}] (*makes sense, if the first number is large, it's hard to beat it*) Plot[N[rejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}] Plot[N[notrejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}]
  • 2. Out[169]= - (-m + n) (1 - m + n) m + n (-1 + x) + x - m x - x1-m+n  (-1 + m - n) (m - n) if condition NIntegrate: The integrand TagBox[TemplateBox[{RowBox[{SuperscriptBox[RowBox[{(, RowBox[{1, -, x}], )}], k], , SuperscriptBox[x, RowBox[{RowBox[{-, k}], +, m}]], , RowBox[{(, RowBox[{RowBox[{RowBox[{(, RowBox[{1, -, SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }], ]}], RowBox[{Times, [, RowBox[{, 6, }], ]}]]}], )}], , RowBox[{(, RowBox[{1, +, x}], )}], , RowBox[{(, RowBox[{1, -, SuperscriptBox[x, RowBox[{Plus, [, RowBox[{, 3, }], ]}]]}], )}]}], +, RowBox[{x, , RowBox[{(, RowBox[{SuperscriptBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}], +, n}]], +, RowBox[{SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }], ]}], RowBox[{Times, [, RowBox[{, 6, }], ]}]], , RowBox[{(, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}], )}]}]}], )}]}]}], )}]}], InterpretationBox[DynamicModuleBox[{Typeset`open = False}, TemplateBox[{ Expression, StyleBox[TagBox[TooltipBox[ "condition", RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{RowBox[{RowBox[{Re, [, RowBox[{RowBox[{Power, [, RowBox[{, 2, }], ]}], , x}], ]}], ≥, 0}], &&, RowBox[{FractionBox[x, RowBox[{Plus, [, RowBox[{, 2, }], ]}]], ≠, 0}]}], )}], ||, RowBox[{FractionBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}]], ∉, TemplateBox[{}, Reals]}], ||, RowBox[{RowBox[{Re, [, FractionBox[x, RowBox[{Plus, [, RowBox[{, 2, }], ]}]], ]}], <, RowBox[{-, 1}]}]}], )}], &&, RowBox[{(, RowBox[{RowBox[{x, ∉, TemplateBox[{}, Reals]}], ||, RowBox[{RowBox[{Re, [, x, ]}], >, 1}], ||, RowBox[{0, <, RowBox[{Re, [, x, ]}], <, 1}]}], )}]}]], Annotation[#1, Short[((Re[Power[<< 2 >>]*x] >= 0 && x/(Plus[<< 2 >> ]) != 0) || NotElement[x/(1 + Times[<< 2 >>]), Reals] || Re[x/( Plus[<< 2 >>])] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[x], Less, 1]), 7], Tooltip] &], IconizedCustomName, StripOnInput -> False], GridBox[{{RowBox[{TagBox["Head: ", IconizedLabel], , TagBox[And, IconizedItem]}]}, {RowBox[{TagBox["Byte count: ", IconizedLabel], , TagBox[1904, IconizedItem]}]}}, GridBoxAlignment -> {Columns -> {{Left}}}, DefaultBaseStyle -> Column, GridBoxItemSize -> {Columns -> {{Automatic}}, Rows -> {{Automatic}}}], Dynamic[Typeset`open]}, IconizedObject]], ((Re[x*<< 2 >>] >= 0 && x/<< 2 >> != 0) || NotElement[x/(1 + << 2 >>), Reals] || Re[x/<< 2 >>] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[ x], Less, 1]), SelectWithContents -> True, Selectable -> False]}, ConditionalExpression], Short[#1, 5] &] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0, 1}}. 2
  • 3. NIntegrate: The integrand TagBox[TemplateBox[{RowBox[{SuperscriptBox[RowBox[{(, RowBox[{1, -, x}], )}], k], , SuperscriptBox[x, RowBox[{RowBox[{-, k}], +, m}]], , RowBox[{(, RowBox[{RowBox[{RowBox[{(, RowBox[{1, -, SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }], ]}], RowBox[{Times, [, RowBox[{, 6, }], ]}]]}], )}], , RowBox[{(, RowBox[{1, +, x}], )}], , RowBox[{(, RowBox[{1, -, SuperscriptBox[x, RowBox[{Plus, [, RowBox[{, 3, }], ]}]]}], )}]}], +, RowBox[{x, , RowBox[{(, RowBox[{SuperscriptBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}], +, n}]], +, RowBox[{SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }], ]}], RowBox[{Times, [, RowBox[{, 6, }], ]}]], , RowBox[{(, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}], )}]}]}], )}]}]}], )}]}], InterpretationBox[DynamicModuleBox[{Typeset`open = False}, TemplateBox[{ Expression, StyleBox[TagBox[TooltipBox[ "condition", RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{RowBox[{RowBox[{Re, [, RowBox[{RowBox[{Power, [, RowBox[{, 2, }], ]}], , x}], ]}], ≥, 0}], &&, RowBox[{FractionBox[x, RowBox[{Plus, [, RowBox[{, 2, }], ]}]], ≠, 0}]}], )}], ||, RowBox[{FractionBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}]], ∉, TemplateBox[{}, Reals]}], ||, RowBox[{RowBox[{Re, [, FractionBox[x, RowBox[{Plus, [, RowBox[{, 2, }], ]}]], ]}], <, RowBox[{-, 1}]}]}], )}], &&, RowBox[{(, RowBox[{RowBox[{x, ∉, TemplateBox[{}, Reals]}], ||, RowBox[{RowBox[{Re, [, x, ]}], >, 1}], ||, RowBox[{0, <, RowBox[{Re, [, x, ]}], <, 1}]}], )}]}]], Annotation[#1, Short[((Re[Power[<< 2 >>]*x] >= 0 && x/(Plus[<< 2 >> ]) != 0) || NotElement[x/(1 + Times[<< 2 >>]), Reals] || Re[x/( Plus[<< 2 >>])] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[x], Less, 1]), 7], Tooltip] &], IconizedCustomName, StripOnInput -> False], GridBox[{{RowBox[{TagBox["Head: ", IconizedLabel], , TagBox[And, IconizedItem]}]}, {RowBox[{TagBox["Byte count: ", IconizedLabel], , TagBox[1904, IconizedItem]}]}}, GridBoxAlignment -> {Columns -> {{Left}}}, DefaultBaseStyle -> Column, GridBoxItemSize -> {Columns -> {{Automatic}}, Rows -> {{Automatic}}}], Dynamic[Typeset`open]}, IconizedObject]], ((Re[x*<< 2 >>] >= 0 && x/<< 2 >> != 0) || NotElement[x/(1 + << 2 >>), Reals] || Re[x/<< 2 >>] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[ x], Less, 1]), SelectWithContents -> True, Selectable -> False]}, ConditionalExpression], Short[#1, 5] &] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0, 1}}. 3
  • 4. Out[173]= 0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0 Out[174]= 0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0 Out[175]= 0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0 (*that looks much better!*) 4
  • 5. In[140]:= Plot[xexp[k, 37, 100, 0.1], {k, 1, 15}] Out[140]= 2 4 6 8 10 12 14 0.60 0.65 0.70 0.75 (*looks like 0.76 and only top 11 or so*) In[141]:= Plot3D[xexp[k, m, 100, 0.1], {k, 1, 20}, {m, 1, 40}] Out[141]= (*it looks like it's telling me top 1 and fire after 4 trials*) In[176]:= Quiet[FindMaximum[xexp[k, m, 100, 0.1], {k, 10}, {m, 37}]] Out[176]= {0.770144, {k → 11.2483, m → 35.5792}} In[177]:= Quiet[FindMaximum[xexp[k, m, 100, 0.1], {k, 1}, {m, 4}]] Out[177]= {0.794735, {k → 3.64866, m → 14.252}} In[179]:= Quiet[FindMaximum[{xexp[k, m, 100, 0.1], 1 ≤ k ≤ 15, 1 ≤ m ≤ 40}, {k, m}]] Out[179]= {0.794735, {k → 3.64867, m → 14.252}} 5
  • 6. (*seems like there could be other local maxima but the global one is at k= 3.65 and m = 14.3*) In[180]:= Quiet[FindMaximum[{xexp[k, m, 1000, 0.1], 1 ≤ k ≤ 50, 1 ≤ m ≤ 400}, {k, m}]] Out[180]= {0.962388, {k → 9.65589, m → 171.697}} In[184]:= Quiet[FindMaximum[{xexp[k, m, 10 000, 0.1], 10 ≤ k ≤ 50, 1000 ≤ m ≤ 2000}, {k, m}]] Out[184]= {0., {k → 19.2022, m → 1085.2}} (*and then it just broke*) In[185]:= Quiet[FindMaximum[{xexp[k, m, 200, 0.1], 1 ≤ k ≤ 15, 1 ≤ m ≤ 40}, {k, m}]] Out[185]= {0.871543, {k → 5.4209, m → 31.5675}} In[188]:= Quiet[FindMaximum[{xexp[k, m, 300, 0.1], 1 ≤ k ≤ 15, 1 ≤ m ≤ 60}, {k, m}]] Out[188]= {0.904275, {k → 6.48495, m → 48.9963}} (*another thing to consider is that (1-r)^(greaterx[n,m,x]) is log-normal, not normal*) In[191]:= greaterx["mean"][n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m) * (y - x) / y * (n - m), {y, x, 1}] greaterx["var"][n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m) * (y - x) / y * x / y * (n - m), {y, x, 1}] Out[191]= - (-m + n) (1 - m + n) m + n (-1 + x) + x - m x - x1-m+n  (-1 + m - n) (m - n) if condition Out[192]= - (-m + n) (1 - m + n) x 1 + m + n (-1 + x) - m x - x-m+n  (m - n) (1 + m - n) if condition In[197]:= (*I need the mean of (1-r)^(Gaussian) - it's mu + var/2. aside: we have ln[term]= log(1-r)*Gaussian, this factor doesn't influence mean or std*) greaterx[n_, m_, x_] = greaterx["mean"][n, m, x] + greaterx["var"][n, m, x] / 2 Out[197]= - (-m + n) (1 - m + n) x 1 + m + n (-1 + x) - m x - x-m+n  2 (m - n) (1 + m - n) - (-m + n) (1 - m + n) m + n (-1 + x) + x - m x - x1-m+n  (-1 + m - n) (m - n) if condition 6
  • 7. In[198]:= rejected[n_, m_, x_, r_] = success[n, m, x] * (1 - r)^(greaterx[n, m, x]); notrejected[n_, m_, x_, r_] = success[n, m, x] * (1 - (1 - r)^(greaterx[n, m, x])); xexp[k_, m_, n_, r_] = A[k, m] / 2 * NIntegrate[x^(m - k) * (1 - x)^k * (x * (failure[n, m, x] + rejected[n, m, x, r]) + (1 + x) * notrejected[n, m, x, r]), {x, 0, 1}]; Plot[N[success[100, 37, x]], {x, 0, 1}, PlotRange → {-0.1, 1}] (*makes sense, if the first number is large, it's hard to beat it*) Plot[N[rejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}] Plot[N[notrejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}] NIntegrate: The integrand TagBox[TemplateBox[{RowBox[{SuperscriptBox[RowBox[{(, RowBox[{1, -, x}], )}], k], , SuperscriptBox[x, RowBox[{RowBox[{-, k}], +, m}]], , RowBox[{(, RowBox[{RowBox[{RowBox[{(, RowBox[{1, -, SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }], ]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]]}], )}], , RowBox[{(, RowBox[{1, +, x}], )}], , RowBox[{(, RowBox[{1, -, SuperscriptBox[x, RowBox[{Plus, [, RowBox[{, 3, }], ]}]]}], )}]}], +, RowBox[{x, , RowBox[{(, RowBox[{SuperscriptBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}], +, n}]], +, RowBox[{SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }], ]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]], , RowBox[{(, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}], )}]}]}], )}]}]}], )}]}], InterpretationBox[DynamicModuleBox[{Typeset`open = False}, TemplateBox[{ Expression, StyleBox[TagBox[TooltipBox[ "condition", RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{RowBox[{RowBox[{Re, [, RowBox[{RowBox[{Power, [, RowBox[{, 2, }], ]}], , x}], ]}], ≥, 0}], &&, RowBox[{FractionBox[x, RowBox[{Plus, [, RowBox[{, 2, }], ]}]], ≠, 0}]}], )}], ||, RowBox[{FractionBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}]], ∉, TemplateBox[{}, Reals]}], ||, RowBox[{RowBox[{Re, [, FractionBox[x, RowBox[{Plus, [, RowBox[{, 2, }], ]}]], ]}], <, RowBox[{-, 1}]}]}], )}], &&, RowBox[{(, RowBox[{RowBox[{x, ∉, TemplateBox[{}, Reals]}], ||, RowBox[{RowBox[{Re, [, x, ]}], >, 1}], ||, RowBox[{0, <, RowBox[{Re, [, x, ]}], <, 1}]}], )}]}]], Annotation[#1, Short[((Re[Power[<< 2 >>]*x] >= 0 && x/(Plus[<< 2 >> ]) != 0) || NotElement[x/(1 + Times[<< 2 >>]), Reals] || Re[x/( Plus[<< 2 >>])] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[x], Less, 1]), 7], Tooltip] &], IconizedCustomName, StripOnInput -> False], GridBox[{{RowBox[{TagBox["Head: ", IconizedLabel], , TagBox[And, IconizedItem]}]}, {RowBox[{TagBox["Byte count: ", IconizedLabel], , TagBox[1904, IconizedItem]}]}}, GridBoxAlignment -> {Columns -> {{Left}}}, DefaultBaseStyle -> Column, GridBoxItemSize -> {Columns -> {{Automatic}}, Rows -> {{Automatic}}}], Dynamic[Typeset`open]}, IconizedObject]], ((Re[x*<< 2 >>] >= 0 && x/<< 2 >> != 0) || NotElement[x/(1 + << 2 >>), Reals] || Re[x/<< 2 >>] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[ x], Less, 1]), SelectWithContents -> True, Selectable -> False]}, ConditionalExpression], Short[#1, 5] &] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0, 1}}. 7
  • 8. NIntegrate: The integrand TagBox[TemplateBox[{RowBox[{SuperscriptBox[RowBox[{(, RowBox[{1, -, x}], )}], k], , SuperscriptBox[x, RowBox[{RowBox[{-, k}], +, m}]], , RowBox[{(, RowBox[{RowBox[{RowBox[{(, RowBox[{1, -, SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }], ]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]]}], )}], , RowBox[{(, RowBox[{1, +, x}], )}], , RowBox[{(, RowBox[{1, -, SuperscriptBox[x, RowBox[{Plus, [, RowBox[{, 3, }], ]}]]}], )}]}], +, RowBox[{x, , RowBox[{(, RowBox[{SuperscriptBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}], +, n}]], +, RowBox[{SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }], ]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]], , RowBox[{(, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}], )}]}]}], )}]}]}], )}]}], InterpretationBox[DynamicModuleBox[{Typeset`open = False}, TemplateBox[{ Expression, StyleBox[TagBox[TooltipBox[ "condition", RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{RowBox[{RowBox[{Re, [, RowBox[{RowBox[{Power, [, RowBox[{, 2, }], ]}], , x}], ]}], ≥, 0}], &&, RowBox[{FractionBox[x, RowBox[{Plus, [, RowBox[{, 2, }], ]}]], ≠, 0}]}], )}], ||, RowBox[{FractionBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}]], ∉, TemplateBox[{}, Reals]}], ||, RowBox[{RowBox[{Re, [, FractionBox[x, RowBox[{Plus, [, RowBox[{, 2, }], ]}]], ]}], <, RowBox[{-, 1}]}]}], )}], &&, RowBox[{(, RowBox[{RowBox[{x, ∉, TemplateBox[{}, Reals]}], ||, RowBox[{RowBox[{Re, [, x, ]}], >, 1}], ||, RowBox[{0, <, RowBox[{Re, [, x, ]}], <, 1}]}], )}]}]], Annotation[#1, Short[((Re[Power[<< 2 >>]*x] >= 0 && x/(Plus[<< 2 >> ]) != 0) || NotElement[x/(1 + Times[<< 2 >>]), Reals] || Re[x/( Plus[<< 2 >>])] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[x], Less, 1]), 7], Tooltip] &], IconizedCustomName, StripOnInput -> False], GridBox[{{RowBox[{TagBox["Head: ", IconizedLabel], , TagBox[And, IconizedItem]}]}, {RowBox[{TagBox["Byte count: ", IconizedLabel], , TagBox[1904, IconizedItem]}]}}, GridBoxAlignment -> {Columns -> {{Left}}}, DefaultBaseStyle -> Column, GridBoxItemSize -> {Columns -> {{Automatic}}, Rows -> {{Automatic}}}], Dynamic[Typeset`open]}, IconizedObject]], ((Re[x*<< 2 >>] >= 0 && x/<< 2 >> != 0) || NotElement[x/(1 + << 2 >>), Reals] || Re[x/<< 2 >>] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[ x], Less, 1]), SelectWithContents -> True, Selectable -> False]}, ConditionalExpression], Short[#1, 5] &] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0, 1}}. 8
  • 9. Out[201]= 0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0 Out[202]= 0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0 Out[203]= 0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0 9
  • 10. In[205]:= greaterxOld[n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m) * (y - x) / y * (n - m), {y, x, 1}] rejectedOld[n_, m_, x_, r_] = success[n, m, x] * (1 - r)^(greaterxOld[n, m, x]); Quiet[Plot[N[rejectedOld[100, 37, x, 0.1] - rejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}]] Out[205]= - (-m + n) (1 - m + n) m + n (-1 + x) + x - m x - x1-m+n  (-1 + m - n) (m - n) if condition Out[207]= 0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0 (*that's good news, we don't reject as many as we thought*) In[242]:= (*all code together*) success[n_, m_, x_] = (1 - x^(1 - m + n)); failure[n_, m_, x_] = x^(1 - m + n); greaterx["mean"][n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m) * (y - x) / y * (n - m), {y, x, 1}]; greaterx["var"][n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m) * (y - x) / y * x / y * (n - m), {y, x, 1}]; greaterx[n_, m_, x_] = greaterx["mean"][n, m, x] + greaterx["var"][n, m, x] / 2; (*r is the acceptance rate*) rejected[n_, m_, x_, r_] = success[n, m, x] * (1 - r)^(greaterx[n, m, x]); (*the rejection rate is log-normally distributed, so long tail warning*) notrejected[n_, m_, x_, r_] = success[n, m, x] * (1 - (1 - r)^(greaterx[n, m, x])); xexp[k_, m_, n_, r_] = A[k, m] / 2 * NIntegrate[x^(m - k) * (1 - x)^k * (x * (failure[n, m, x] + rejected[n, m, x, r]) + (1 + x) * notrejected[n, m, x, r]), {x, 0, 1}]; Quiet[Plot[N[success[100, 37, x]], {x, 0, 1}, PlotRange → {-0.1, 1}]] Quiet[Plot[N[rejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}]] Quiet[Plot[N[notrejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}]] 10
  • 11. NIntegrate: The integrand TagBox[TemplateBox[{RowBox[{SuperscriptBox[RowBox[{(, RowBox[{1, -, x}], )}], k], , SuperscriptBox[x, RowBox[{RowBox[{-, k}], +, m}]], , RowBox[{(, RowBox[{RowBox[{RowBox[{(, RowBox[{1, -, SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }], ]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]]}], )}], , RowBox[{(, RowBox[{1, +, x}], )}], , RowBox[{(, RowBox[{1, -, SuperscriptBox[x, RowBox[{Plus, [, RowBox[{, 3, }], ]}]]}], )}]}], +, RowBox[{x, , RowBox[{(, RowBox[{SuperscriptBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}], +, n}]], +, RowBox[{SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }], ]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]], , RowBox[{(, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}], )}]}]}], )}]}]}], )}]}], InterpretationBox[DynamicModuleBox[{Typeset`open = False}, TemplateBox[{ Expression, StyleBox[TagBox[TooltipBox[ "condition", RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{RowBox[{RowBox[{Re, [, RowBox[{RowBox[{Power, [, RowBox[{, 2, }], ]}], , x}], ]}], ≥, 0}], &&, RowBox[{FractionBox[x, RowBox[{Plus, [, RowBox[{, 2, }], ]}]], ≠, 0}]}], )}], ||, RowBox[{FractionBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}]], ∉, TemplateBox[{}, Reals]}], ||, RowBox[{RowBox[{Re, [, FractionBox[x, RowBox[{Plus, [, RowBox[{, 2, }], ]}]], ]}], <, RowBox[{-, 1}]}]}], )}], &&, RowBox[{(, RowBox[{RowBox[{x, ∉, TemplateBox[{}, Reals]}], ||, RowBox[{RowBox[{Re, [, x, ]}], >, 1}], ||, RowBox[{0, <, RowBox[{Re, [, x, ]}], <, 1}]}], )}]}]], Annotation[#1, Short[((Re[Power[<< 2 >>]*x] >= 0 && x/(Plus[<< 2 >> ]) != 0) || NotElement[x/(1 + Times[<< 2 >>]), Reals] || Re[x/( Plus[<< 2 >>])] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[x], Less, 1]), 7], Tooltip] &], IconizedCustomName, StripOnInput -> False], GridBox[{{RowBox[{TagBox["Head: ", IconizedLabel], , TagBox[And, IconizedItem]}]}, {RowBox[{TagBox["Byte count: ", IconizedLabel], , TagBox[1904, IconizedItem]}]}}, GridBoxAlignment -> {Columns -> {{Left}}}, DefaultBaseStyle -> Column, GridBoxItemSize -> {Columns -> {{Automatic}}, Rows -> {{Automatic}}}], Dynamic[Typeset`open]}, IconizedObject]], ((Re[x*<< 2 >>] >= 0 && x/<< 2 >> != 0) || NotElement[x/(1 + << 2 >>), Reals] || Re[x/<< 2 >>] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[ x], Less, 1]), SelectWithContents -> True, Selectable -> False]}, ConditionalExpression], Short[#1, 5] &] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0, 1}}. 11
  • 12. NIntegrate: The integrand TagBox[TemplateBox[{RowBox[{SuperscriptBox[RowBox[{(, RowBox[{1, -, x}], )}], k], , SuperscriptBox[x, RowBox[{RowBox[{-, k}], +, m}]], , RowBox[{(, RowBox[{RowBox[{RowBox[{(, RowBox[{1, -, SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }], ]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]]}], )}], , RowBox[{(, RowBox[{1, +, x}], )}], , RowBox[{(, RowBox[{1, -, SuperscriptBox[x, RowBox[{Plus, [, RowBox[{, 3, }], ]}]]}], )}]}], +, RowBox[{x, , RowBox[{(, RowBox[{SuperscriptBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}], +, n}]], +, RowBox[{SuperscriptBox[RowBox[{Plus, [, RowBox[{, 2, }], ]}], RowBox[{Plus, [, RowBox[{, 2, }], ]}]], , RowBox[{(, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}], )}]}]}], )}]}]}], )}]}], InterpretationBox[DynamicModuleBox[{Typeset`open = False}, TemplateBox[{ Expression, StyleBox[TagBox[TooltipBox[ "condition", RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{RowBox[{RowBox[{Re, [, RowBox[{RowBox[{Power, [, RowBox[{, 2, }], ]}], , x}], ]}], ≥, 0}], &&, RowBox[{FractionBox[x, RowBox[{Plus, [, RowBox[{, 2, }], ]}]], ≠, 0}]}], )}], ||, RowBox[{FractionBox[x, RowBox[{1, +, RowBox[{Times, [, RowBox[{, 2, }], ]}]}]], ∉, TemplateBox[{}, Reals]}], ||, RowBox[{RowBox[{Re, [, FractionBox[x, RowBox[{Plus, [, RowBox[{, 2, }], ]}]], ]}], <, RowBox[{-, 1}]}]}], )}], &&, RowBox[{(, RowBox[{RowBox[{x, ∉, TemplateBox[{}, Reals]}], ||, RowBox[{RowBox[{Re, [, x, ]}], >, 1}], ||, RowBox[{0, <, RowBox[{Re, [, x, ]}], <, 1}]}], )}]}]], Annotation[#1, Short[((Re[Power[<< 2 >>]*x] >= 0 && x/(Plus[<< 2 >> ]) != 0) || NotElement[x/(1 + Times[<< 2 >>]), Reals] || Re[x/( Plus[<< 2 >>])] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[x], Less, 1]), 7], Tooltip] &], IconizedCustomName, StripOnInput -> False], GridBox[{{RowBox[{TagBox["Head: ", IconizedLabel], , TagBox[And, IconizedItem]}]}, {RowBox[{TagBox["Byte count: ", IconizedLabel], , TagBox[1904, IconizedItem]}]}}, GridBoxAlignment -> {Columns -> {{Left}}}, DefaultBaseStyle -> Column, GridBoxItemSize -> {Columns -> {{Automatic}}, Rows -> {{Automatic}}}], Dynamic[Typeset`open]}, IconizedObject]], ((Re[x*<< 2 >>] >= 0 && x/<< 2 >> != 0) || NotElement[x/(1 + << 2 >>), Reals] || Re[x/<< 2 >>] < -1) && (NotElement[x, Reals] || Re[x] > 1 || Inequality[0, Less, Re[ x], Less, 1]), SelectWithContents -> True, Selectable -> False]}, ConditionalExpression], Short[#1, 5] &] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0, 1}}. 12
  • 13. Out[250]= 0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0 Out[251]= 0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0 Out[252]= 0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0 In[241]:= Quiet[FindMaximum[xexp[k, m, 100, 0.1], {k, 1}, {m, 4}]] Out[241]= {0.828168, {k → 3.5195, m → 16.5013}} 13
  • 14. (*so the median person has it considerably worse than the mean person - which one am I*) (*I think I am the mean person. The reason is that the log- normal distribution gets integrated over all outcomes of the first trial- phase so that means it becomes Gaussian again due to the Central Limit Theorem - am I wrong?*) 14