So altogether, finding the real roots might look something like this: >>> ... def rroots(eq, x, eps=None): ... p = sqf(Poly(eq, x, extension=True).lift()) ... if p.is_Mul: ... p = [pi.base if pi.is_Pow else pi for pi in p.args] ... else: ... p = [p] ... intv = flatten([Poly(pi, x).intervals(eps=eps) for pi in p], 1) ... rv = [] ... for (a, b), c in intv: ... try: ... root = nsolve(eq, x, (a+b)/2, tol=eps) ... if a <= root <= b: ... rv.append(Float(root)) ... except: pass ... return rv ... >>> rroots(eq,x,eps=.1) [-0.774799299008846, 1.07288890926981] >>> rroots(eq,x) [-0.774596691590882, 1.07267042449333]
-- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.