I am having a very strange issue. I have the following piece of code:

ee = 0.685149/(1 - E^-l) 
Plot[ee, {l, 1.8, 10}]
NMinimize[{ee, 1.8 <= l <= 10}, l]

As can be seen from the plot, the function is decreasing and is minimized at $l=10$. Mathematica indeed finds the correct minimizer, but the value is negated:

{-0.685181, {l -> 10.}}

I am very confused why the value is negated. Any idea?

ee /. l -> 10

Version: "13.1.0 for Mac OS X x86 (64-bit) (June 16, 2022)"

enter image description here

  • $\begingroup$ Update: When I add Method -> NelderMead to NMinimize, it works fine, so it seems "Automatic" is buggy somehow? $\endgroup$ May 3 at 19:11
  • $\begingroup$ v12.2.0 on Win7-x64 does not show the negation. Please add the output of $Version to your post. $\endgroup$
    – Syed
    May 3 at 19:48
  • $\begingroup$ v13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023) works as expected $\endgroup$
    – Bob Hanlon
    May 3 at 20:03
  • $\begingroup$ Here is the version: "13.1.0 for Mac OS X x86 (64-bit) (June 16, 2022)". Perhaps I'll update to 13.2 and try again. $\endgroup$ May 4 at 0:52
  • $\begingroup$ OK in 13.2 on Windows 10. $\endgroup$
    – user64494
    May 4 at 6:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.