Re: How to remove duplicate solutions (Solve)?
- To: mathgroup at smc.vnet.net
- Subject: [mg91801] Re: How to remove duplicate solutions (Solve)?
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 8 Sep 2008 05:03:27 -0400 (EDT)
- References: <ga24hv$gia$1@smc.vnet.net>
Peng Yu wrote:
> Solve[(x - 1)^2 == 0, x]
>
> The above code would give me the solution
> {{x -> 1}, {x -> 1}}
>
> But one is a duplicate of the other. I'm wondering how to only produce
The online help reads, "When a particular root has multiplicity greater
than one, Solve gives several copies of the corresponding solution."
> the unique solutions.
You could use *Union[]*.
In[1]:= Solve[(x - 1)^2 == 0, x] // Union
Out[1]= {{x -> 1}}
Regards,
-- Jean-Marc