0
$\begingroup$

When doing

Plot[ArgMin[Norm[x - {-3, -1, 0, 5}, p], x], {p, 1, 3}]

I get this error message:

Plot::exclul: {(Abs[-5+x]^p+Abs[x]^p+Abs[1+x]^p+Abs[3+x]^p)-0,(3+x)-0,(1+x)-0,x-0,(-5+x)-0,
 p-0,Im[Abs[-5+x]^p+Abs[x]^p+Abs[1+x]^p+Abs[3+x]^p]-0}
 must be a list of equalities or real-valued functions.

The plot itself seems to be OK

enter image description here

-- although I am not sure because of this error. What caused it?

$\endgroup$
  • 1
    $\begingroup$ What happens if you add Exclusions -> None? $\endgroup$ – J. M. is away Jan 5 at 4:53
  • $\begingroup$ @J.M.iscomputer-less Aha the error is gone then. The plot is the same. Could you explain this, in an answer? $\endgroup$ – მამუკა ჯიბლაძე Jan 5 at 4:54
  • $\begingroup$ Before anything else: what version and OS is this? $\endgroup$ – J. M. is away Jan 5 at 4:54
  • 1
    $\begingroup$ @J.M.iscomputer-less 11.0.1.0 on Windows 10 $\endgroup$ – მამუკა ჯიბლაძე Jan 5 at 4:55
  • 2
    $\begingroup$ I do not get an error message with v11.3 on a Mac. $\endgroup$ – Bob Hanlon Jan 5 at 4:59
1
$\begingroup$

This is a bug that seems to have been resolved in version 11.1, and is related to the exclusion detection functionality used by Mathematica to detect discontinuities. (The presence of Abs[] in the function being analyzed is what triggered the exclusion detection.)

Since you know that the function is continuous in your range of interest, just add Exclusions -> None:

Plot[ArgMin[Norm[x - {-3, -1, 0, 5}, p], x], {p, 1, 3}, 
     Exclusions -> None]
$\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.