I have a list that is of the following form


I want this set to become this:


I tried the following:


But with no success. Functions like Abs also don't work, since x,y,z,a are not defined.


closed as off-topic by Dr. belisarius, user9660, RunnyKine, MarcoB, J. M. will be back soon Mar 28 '16 at 19:16

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Dr. belisarius, Community, RunnyKine, MarcoB, J. M. will be back soon
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ Try the rule -1*x_ :> x $\endgroup$ – Marius Ladegård Meyer Mar 28 '16 at 15:17
  • $\begingroup$ Oh that works fine! Thank you! $\endgroup$ – Jasper Mar 28 '16 at 15:19
  • $\begingroup$ {-x, y, -z, a} /. -t_ :> t works too. $\endgroup$ – andre314 Mar 28 '16 at 15:21
  • 1
    $\begingroup$ If you want to see what are the real "words" behind the expression {-x,y,-z,a} try : FullForm[{-x,y,-z,a}], you will see there no Minus, so your replacement rule will have no effect. $\endgroup$ – andre314 Mar 28 '16 at 15:27
  • 1
    $\begingroup$ I didn't know about the FullForm expression yet. Thank you for that, that may create lots less struggle in the future with similar problems :) $\endgroup$ – Jasper Mar 28 '16 at 15:31

Browse other questions tagged or ask your own question.