In giac if I have a polynomial with multiple roots, I also get multiple roots with proot (I cannot rely on root etc. because my polynomials have generally large degrees). This often leads to problem in my program. So I need to convert the output root into a set (python type) or something that will discard the multple root entries in the list. What is the fastest way of doing this? Here is a sample code with proot
Code : Tout sélectionner
from giacpy import proot, giac
x=giac("x")
proot(x**3) #outputs a list [0,0,0], what I want is [0]
set(proot(x**3)) #produces an error because giac gens are not hashable
Edit: I ended up using froot. Because this will just give the multiplicity number (instead of repeated numbers) so instead of [0,0,0] in the above example I would get [0,3]. With this I can just skip the second entry of the list and get the unique roots. Though, I do not know if froot will have any negative effect (e.g. are all (numerical) roots solved up to some precision?)