2
$\begingroup$

Im doing the same problem with ArgMin and NArgMin, however NArgMin messes up the order of the solution.

Given function:

L[x_]=x a + (1+4/x) b;

NArgMin[{L, L'[1] == 0, L[1] == 100}, {a, b}]
{11.1111, 44.4444}

However:

ArgMin[{L, L'[1] == 0, L[1] == 100}, {a, b}] // N
{44.4444, 11.1111}

The correct result is a = 44.4444, b = 11.1111 coming from ArgMin, where NArgMin swaps a and b.

Is this a bug or I am doing something wrong? If I scale the problem to many more variables (a,b,c,...) I want to know what output corresponds to.

Edit: This is a bug I had in Mathematica version 11.3. After installing Version 12.0, both approaches gives the same answer.

$\endgroup$
  • $\begingroup$ The workaround in v11.3 is to use NMinimize, i.e., {a, b} /. NMinimize[{L, L'[1] == 0, L[1] == 100}, {a, b}][[2]] $\endgroup$ – Bob Hanlon May 25 at 15:01
  • $\begingroup$ Note that the first argument L is not valid. Perhaps you meant L[1]? (It's only a side issue here, because there is just one point satisfying the constraints.) $\endgroup$ – Michael E2 May 25 at 21:52
0
$\begingroup$

This is working for me, which version of Mathematica are you using?

Working

$\endgroup$
  • $\begingroup$ Wow! I'm using 11.3.0.0 on Mac. Could you tell me your version? $\endgroup$ – maxgo2 May 25 at 9:05
  • $\begingroup$ Version Number: 12.0.0.0 Platform: Mac OS X x86 (64-bit) $\endgroup$ – wilsnunn May 25 at 9:07
  • 1
    $\begingroup$ Thank you for response, I am downloading version 12 and will update the status. $\endgroup$ – maxgo2 May 25 at 9:21
  • 1
    $\begingroup$ I have installed Mathematica 12.0.0 and it is working perfectly as in the picture! $\endgroup$ – maxgo2 May 25 at 9:53

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.