Ask Your Question

About finding roots of polynomials in specific domains

asked 2015-06-11 23:31:40 +0200

Phoenix gravatar image

updated 2015-06-11 23:33:17 +0200

I have two polynomials $p(x)$ and $q(x)$ and I want to know if there are roots of the equation $\frac{p'}{p} = \frac{q'}{q}$ in the domain $(a,\infty)$ , where $a = max { roots(p), roots(q) } $

This is the same as asking for the roots of the polynomial, $p'q - pq' = 0$ in the same domain.

  • Can something in Sage help?
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2015-06-12 11:28:20 +0200

B r u n o gravatar image

updated 2015-06-12 11:30:13 +0200

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([x[0] for x in 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]
edit flag offensive delete link more


Thanks! Let me try this.

Phoenix gravatar imagePhoenix ( 2015-06-12 19:56:35 +0200 )edit

If you just wrote "p.roots()" would it give all the roots? (and not just the reals)

Phoenix gravatar imagePhoenix ( 2015-06-12 19:57:23 +0200 )edit

And what would be a command to check if R turned out to be empty? I need some kind of an error catching for that.

Phoenix gravatar imagePhoenix ( 2015-06-12 19:58:16 +0200 )edit

If I am reading the code correctly and R is a list, then you could try len(R) == 0 . If I misunderstood, then nevermind.

Wizq gravatar imageWizq ( 2015-06-14 00:48:40 +0200 )edit

answered 2015-06-12 13:48:19 +0200

vdelecroix gravatar image

updated 2015-06-12 13:50:33 +0200


def are_there_roots(p, q):
    return False
edit flag offensive delete link more


What if, for example, $p=q\neq 0$ or if $p'$ and $q'$ have a common root that is larger than $a$ ?

tmonteil gravatar imagetmonteil ( 2015-06-12 14:56:14 +0200 )edit

I think it's hard for $p'$ and $q'$ to have a common root larger that the largest root of $p$ and $q$... I am impressed by how exact yet uninformative this answer is!

B r u n o gravatar imageB r u n o ( 2015-06-12 16:15:03 +0200 )edit

@b-r-u-n-o wrote:

I think it's hard f=or p′ and q′ to have a common root larger that the largest root of p and q...

What about, say, $p=q=x^3+8$ whose single real root is -2, but whose derivative have root 0 ?

tmonteil gravatar imagetmonteil ( 2015-06-12 17:41:18 +0200 )edit

max(roots(p), roots(q)) is ambiguous.

vdelecroix gravatar imagevdelecroix ( 2015-06-12 22:55:34 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-06-11 23:31:40 +0200

Seen: 479 times

Last updated: Jun 12 '15