# Delete complex conjugate in a list

I have a list with complex numbers. I would like to delete a number $$z$$ that is in my list if at least one of these conditions is met:

• $$-z$$ is also in the list
• $$\bar{z}$$ is in the list
• $$-\bar{z}$$ is in the list

Where $$\bar{z}$$ represents the complex conjugate of $$z$$.

For example in the list: $$L=\{4,2+\mathrm{i},-4,3,-2+\mathrm{i},-2-\mathrm{i},2-\mathrm{i}\}$$ After applying the algorithm only the element $$3$$ remains: $$L\to\tilde{L}=\{3\}$$

The problem is that I can have up to 6000 elements in my list. Is there a smart way to proceed?

Or use Gather

Gather[
{4, 2 + I, -4, 3, -2 + I, -2 - I, 2 - I}, #1 == Conjugate[#2] || #1 + #2 ==
0 || #1 + Conjugate[#2] == 0 & ] // Cases[{x_} :> x]

{3}


You could use GroupBy:

Cases[
GroupBy[{4, 2+I, -4, 3, -2+I, -2-I, 2-I}, Abs @* ReIm],
{v_} :> v
]


{3}

• I'd suggest Abs@Re@# + I*Abs@Im@# & instead of Norm. (Consider {..., -4 + 3 I, 3 + 4 I,...}.) Mar 19, 2021 at 16:01
• @MichaelE2 good point Mar 19, 2021 at 16:03