Here is my simple example, and in this case function DeleteDuplicates does not work as expected.
I want to FindRoot of my function $\chi[\nu]$, and since function $\chi$ is very sensitive to initial guess I decided to generate many initial conditions and
leave only those solutions which are distinct. For this purpose I want to apply DeleteDuplicates on the resulting list of solution.
Here is the definition of my function:
χ[ν_] := 2*PolyGamma[1] - PolyGamma[1/2 + I*ν] - PolyGamma[1/2 - I*ν]
Here I generate many solution according to many random initial guesses
m = Table[v /. FindRoot[χ[v] == -1.2 - 0.2*I, {v, RandomComplex[]}], {i, 1, 10}]
And finally, I want to leave only distinct solutions:
DeleteDuplicates[m]
Unfortunately, the operation DeleteDuplicates[m] does not change the list m, although there are many identical values.
Namely:
DeleteDuplicates[m]
{1.06423 + 0.0968739 I, 1.06423 + 0.0968739 I, 1.06423 + 0.0968739 I, 1.06423 + 0.0968739 I, 0.0250407 + 1.00352 I, 1.06423 + 0.0968739 I, 1.06423 + 0.0968739 I, 1.06423 + 0.0968739 I, 0.0250407 + 1.00352 I, 1.06423 + 0.0968739 I}
I'm puzzled.
Any help or suggestions are very welcome!
Thanks!
DeleteDuplicates[m, Abs[#1 - #2] < 0.01 &]. – b.gates.you.know.what Mar 20 '13 at 09:59@b.gatessucks: Great, works like a charm. Could you explain the reason? I'm quite new to this.
Thanks a lot for help!
– Arnold Klein Mar 20 '13 at 10:03