3
$\begingroup$

Consider the following code:

A = 575;
B = 291;
pMeBis[k_, delta_, nAvg_] := 
 1/Binomial[A, 
    2]*(Binomial[A, 
      2]*(delta/Binomial[A, 2] + Pi^2/16*(B^k)/nAvg))^(2^k)
NMinimize[pMeBis[k, 0.9, 10^31], k \[Element] Integers]

It tells me: {0., {k -> 8}}

So the minimal value is for k=8.

However, I have:

In[24]:= pMeBis[8, 0.9, 10^31]

Out[24]= 1.17111*10^-17

In[25]:= pMeBis[10, 0.9, 10^31]

Out[25]= 2.02939*10^-31

Thus, Mathematica is wrong. Why is it so ?

$\endgroup$
5
$\begingroup$

The numerical portion of the NMinimize function likely gets confused with all the large powers of 10. Try the non-numeric version instead, making sure to use only integers or rational numbers, so it does not convert to numerics automatically:

Minimize[pMeBis[k, 9/10, 10^31], k ∈ Integers]//N

{0., {k -> 10.}}

$\endgroup$
4
$\begingroup$

NMinimize finds the solution if you increase the WorkingPrecision

NMinimize[pMeBis[k, 0.9, 10^31], k \[Element]Integers,WorkingPrecision -> 50]
(*{2.0293883409099669577878953337601566621641181036332*10^-31, {k ->10}}*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.