Hello guys. This is the table with the result that should be got https://www.dropbox.com/s/rohvusatedkfh3r/Screenshot_20180725-184452.png?dl=0 The mysticism thing is that it found a part of correct values only with NMaximize. With 3000-26000 everithing is OK but with others a strange thing is happening. For example, if I take 3000 and more I get the right answer
Clear["Global`*"]
n = 100;
Y = 1000000;
q = NMaximize[{n!/((94)!*4!)*p0^(94)*ap10^4*p1*p2,
p0 + p1 + p100 + p2 + ap10 == 1 && p0 >= 0 && p1 >= 0 && p2 >= 0 &&
ap10 >= 0 &&
p100 >= 0 && (1/100)*Y*(-10*ap10 + 30*p1 + 40*p2 + 100*p100) ==
3000}, {p0, p1, p2, p100, ap10}]
{0.0272692, {p0 -> 0.94, p1 -> 0.00999995, p2 -> 0.00999991,
p100 -> 5.71366*10^-8, ap10 -> 0.0400001}}
So I took all values from -6000 to 29000 and get this. Most of the values are correct, but some of the definatele wrong.
{
RowBox[{"-", "6000"}], "0.00273003019908044`"},
{
RowBox[{"-", "5000"}], "4.002433792920723`*^-12"},
{
RowBox[{"-", "4000"}], "9.420778019991495`*^-80"},
{
RowBox[{"-", "3000"}], "0.010805254786454756`"},
{
RowBox[{"-", "2000"}], "0.014835126377371699`"},
{
RowBox[{"-", "1000"}], "1.1255118610736836`"},
{"0", "1.0083957979097389`"},
{"1000", "3.3664295470533197`*^-22"},
{"2000", "1.0105517857633675`"},
{"3000", "0.027269195370073815`"},
{"4000", "0.026831313283137287`"},
{"5000", "0.025659720271071166`"},
{"6000", "0.02396928739747252`"},
{"7000", "0.021955363082878255`"},
{"8000", "0.019861954802262567`"},
{"9000", "0.017956439320638243`"},
{"10000", "0.01623208221174882`"},
{"11000", "0.01467181808621124`"},
{"12000", "0.013260174294049413`"},
{"13000", "0.011983123654999555`"},
{"14000", "0.01082795065726872`"},
{"15000", "0.00978312998048758`"},
{"16000", "6.311707230722985`*^-18"},
{"17000", "0.007983743159662302`"},
{"18000", "0.007211133780524158`"},
{"19000", "0.00651261660134752`"},
{"20000", "0.005881151176722276`"},
{"21000", "0.005310359883946591`"},
{"22000", "0.004794466105647533`"},
{"23000", "0.004328238122009399`"},
{"24000", "0.003906938191582962`"},
{"25000", "0.0035262763453895838`"},
{"26000", "0.0031823684622467223`"},
{"27000", "4.580651706257595`*^-15"},
{"28000", "2.32433808006728`*^-15"},
{"29000", "1.5695861700229384`*^-14"}
That is more interesting with reduce function gives different results.
Clear["Global`*"]
n = 100;
Y = 1000000;
r = Reduce[
p0 + p1 + p100 + p2 + ap10 == 1 && p0 >= 0 && p1 >= 0 && p2 >= 0 &&
ap10 >= 0 &&
p100 >= 0 && (1/100)*Y*(-10*ap10 + 30*p1 + 40*p2 + 100*p100) ==
3000, {ap10, p0, p1, p2, p100}, Reals, Backsubstitution -> True];
q = NMaximize[{n!/((94)!*4!)*p0^(94)*ap10^4*p1*p2, r}, {p0, p1, p2,
p100, ap10}]
{0.0230288, {p0 -> 0.940867, p1 -> 0.00763999, p2 -> 0.00891332, p100 -> 0.00127333, ap10 -> 0.0413065}} FInd Maximum also dosent work
Clear["Global`*"]
Y = 1000000;
n = 100;
q = FindMaximum[{n!/((94)!*4!)*p0^(94)*p1*p2*p10^4,
p0 + p1 + p100 + p2 + p10 == 1 && p0 >= 0 && p1 >= 0 && p2 >= 0 &&
p100 >= 0 &&
p10 >= 0 && (1/100)*Y*(-10*p10 + 30*p1 + 40*p2 + 100*p100) ==
3000}, {{p0, 0.91}, {p1, 0.01387}, {p2, 0.016}, {p100,
0.021}, {p10, 0.35}}]
{4.61652*10^-31, {p0 -> 0.412788, p1 -> 0.0133285, p2 -> 0.0185802,
p100 -> 0.0428179, p10 -> 0.512485}}
So what is that, wrong table at dropbox or I need to use a different code? Multiple searches also dont do a good thing,http://community.wolfram.com/groups/-/m/t/1164680
n = 100;
Y = 1000000;
iMin[-n!/((94)!*4!)*p0^(94)*p1*p2*p10^4,
List @@ (p0 + p1 + p2 + p10 + p100 == 1 &&
p0 >= 0 && p1 >= 0 && p2 >= 0 && p100 >= 0 &&
p10 >= 0 && (1/100)*Y*(-10*p10 + 30*p1 + 40*p2 + 100*p100) ==
3000),
Thread[{{p0, p1, p2, p100, p10}, 0, 1}], 10, 0]
{-1.57794*10^-44, {p0 -> 0.289568, p1 -> 0.0329513, p2 -> 0.0407228,
p100 -> 0.0368193, p10 -> 0.599939}}