Sort with assumptions
6
3
$begingroup$
I have a list which looks like this list = {0, Subscript[x,7], -Subscript[x,3]-Subscript[x,9], -Subscript[x,9]}; and all the $x_i$ 's are positive semidefinite (i.e. nonnegative) real numbers. I would like to be able to sort this into sortedlist = {-Subscript[x,3]-Subscript[x,9], -Subscript[x,9], 0, Subscript[x,7]} How do I achieve this? I tried Assuming[Subscript[x,3] > 0 && Subscript[x,7] > 0 && Subscript[x,9] > 0, Sort[list]] But this obviously does not work. In general, I'd like to be able to impose more constraints on the $x_i's$ when they're being sorted.
list-manipulation symbolic array sorting
share | improve this question
...