As an easy exercise, I would like to define a function

$$f(x)=\pm x$$

and be able to ListPlot the function for some discrete values.

Here is what I tried

F[x_] := PlusMinus[x];
Table[F[x], {x, 1, 4}]

This gives me output

{\[PlusMinus]1, \[PlusMinus]2, \[PlusMinus]3, \[PlusMinus]4}

This is exactly what I want. But now I want to listplot it using

ListPlot[Table[F[x], {x, 1, 4}]]

But this does not give me output.

So, I guess my question is how to convert the output of PlusMinus[2] which is $\pm2$ to an array $\{-2,2\}$ so that I can do other operations on it.

  • 7
    $\begingroup$ PlusMinus has no built-in meaning apart from the typesetting. Do you want Around instead? $\endgroup$
    – Jason B.
    Commented May 24, 2022 at 19:43
  • 4
    $\begingroup$ Why don't you just define F as F[x_] := {x, -x} ? $\endgroup$
    – lericr
    Commented May 24, 2022 at 19:52

1 Answer 1


Per the documentation, you could define the function for PlusMinus:

PlusMinus[a_] := {-a, a}
(* {-2,2} *)
ListPlot[Table[\[PlusMinus]i, {i, 4}]]

enter image description here


Your Answer

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

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