SlideShare a Scribd company logo
1 of 14
Download to read offline
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
 
PMHMathematicaSample
PMHMathematicaSamplePMHMathematicaSample
PMHMathematicaSamplePeter Hammel
 
Least Squares, Lasso, Ridge and ElasticNet
Least Squares, Lasso, Ridge and ElasticNetLeast Squares, Lasso, Ridge and ElasticNet
Least Squares, Lasso, Ridge and ElasticNetHossam 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.pdfkarthikaparthasarath
 
Modul 3 quadratic function
Modul 3 quadratic functionModul 3 quadratic function
Modul 3 quadratic functionHafidz 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 ManualLewisSimmonss
 
Storyboard math
Storyboard mathStoryboard math
Storyboard mathshandex
 
Javascript Array map method
Javascript Array map methodJavascript Array map method
Javascript Array map methodtanerochris
 
Interpolation functions
Interpolation functionsInterpolation functions
Interpolation functionsTarun Gehlot
 
ejercicio 140 libro de baldor resuelto
ejercicio 140 libro de baldor resueltoejercicio 140 libro de baldor resuelto
ejercicio 140 libro de baldor resueltoIvan Lobato Baltazar
 
Groovy Refactoring Patterns
Groovy Refactoring PatternsGroovy Refactoring Patterns
Groovy Refactoring PatternsNaresha 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 212Mahmoud 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 EvfimievskiArvind 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 EvfimievskiArvind Surve
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4Roziq 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
 
Pre-calculus 1, 2 and Calculus I (exam notes)
Pre-calculus 1, 2 and Calculus I (exam notes)Pre-calculus 1, 2 and Calculus I (exam notes)
Pre-calculus 1, 2 and Calculus I (exam notes)William Faber
 

Similar to Secretary_Game_With_Rejection.pdf (20)

数式処理ソフトMathematicaで数学の問題を解く
数式処理ソフトMathematicaで数学の問題を解く数式処理ソフトMathematicaで数学の問題を解く
数式処理ソフトMathematicaで数学の問題を解く
 
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
 
Pre-calculus 1, 2 and Calculus I (exam notes)
Pre-calculus 1, 2 and Calculus I (exam notes)Pre-calculus 1, 2 and Calculus I (exam notes)
Pre-calculus 1, 2 and Calculus I (exam notes)
 

Recently uploaded

CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts ServiceSapana Sha
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 

Recently uploaded (20)

CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts Service
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 

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