Timeline for What is the easiest and efficient way to get positive or negative combinations of a list?
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 24, 2021 at 15:51 | history | edited | Michael E2 |
edited tags
|
|
Feb 24, 2021 at 15:50 | answer | added | Michael E2 | timeline score: 2 | |
Feb 24, 2021 at 15:26 | answer | added | WReach | timeline score: 2 | |
Feb 24, 2021 at 9:24 | answer | added | Daniel Huber | timeline score: 1 | |
Feb 24, 2021 at 7:50 | comment | added | J. M.'s missing motivation♦ | I am not sure, and that's why I left a comment and not an answer. I agree it can quickly get combinatorically prohibitive. | |
Feb 24, 2021 at 7:49 | comment | added | user13892 | @J.M. Yes, it seems to be producing the correct result for the cases I tested. But is there a way to directly produce this outcome instead of first finding all combinations and then filtering the relevant ones? | |
Feb 24, 2021 at 7:26 | comment | added | J. M.'s missing motivation♦ |
Does tal = Lookup[Counts[list], Union[list], 0]; Select[Subsets[{Splice[list], Splice[-list]}, {1, Length[list]}], And @@ Thread[Lookup[Counts[Abs[#]], Union[list], 0] <= tal] &] do what you want?
|
|
Feb 24, 2021 at 3:56 | answer | added | cvgmt | timeline score: 2 | |
Feb 24, 2021 at 3:35 | history | asked | user13892 | CC BY-SA 4.0 |