# Revision history [back]

I would do as follows:

sage: r = p.derivative()*q - q*p.derivative()
sage: R_r = r.roots(RR)


This gives you the real roots of r in the variable R_r. Now to filter the roots that make sense to you, you need to compute the roots of p and q:

sage: R_p = p.roots(RR)
sage: R_q = q.roots(RR)


To find a:

sage: a = max(max([x[0] for x in R_p]), max([x[0] for x in R_q]))


And finally, the roots you want:

sage: R = [x in R_r if x[0] > a]


I would do as follows:

sage: r = p.derivative()*q - q*p.derivative()
sage: R_r = r.roots(RR)


This gives you the real roots of r in the variable R_r. Now to filter the roots that make sense to you, you need to compute the roots of p and q:

sage: R_p = p.roots(RR)
sage: R_q = q.roots(RR)


In R_p and R_q, you have the real roots of p and q, given as pairs with the root and the multiplicity. To find a:

sage: a = max(max([x[0] for x in R_p]), max([x[0] for x in R_q]))
R_p] + [x[0] for x in R_q])


And finally, the roots you want:

sage: R = [x in R_r if x[0] > a]