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.
PlusMinus
has no built-in meaning apart from the typesetting. Do you wantAround
instead? $\endgroup$F[x_] := {x, -x}
? $\endgroup$