Compute minimal polynomial

137 views
Skip to first unread message

ecir...@gmail.com

unread,
Jan 4, 2017, 11:25:02 AM1/4/17
to sympy
I have two algebraic numbers defined by minimal polynomials:

    x, z = symbols('x, z')
    p = Poly((x-1)*(x-2)*(x-3)*(x-4))
    q = Poly((x-5)*(x-6)*(x-7)*(x-8))

and I would like to compute the sum of these numbers. I [found](http://math.stackexchange.com/a/155132/327863) that I need to "`z=x+y` is a root of the resultant of `P(x)` and `Q(z−x)` (where we take this resultant by regarding `Q` as a polynomial in only `x`)".

I'm totally new to all this algebraic numbers thing so I don't quite understand the advice but I tried:

    resultant(p, q.subs(x, z-x))

but then I got stuck. Please, could someone explain to me:

- I would like to see the steps that lead to the computation of desired minimal polynomial with the help of resultant. I think I defined the two numbers properly but I don't know how to express that `Q(z−x)`.

- As it stands now, the `resultant` function returns bivariate polynomial but I would've assumed that the resulting minimal polynomial should be univariate. How do I get rid of the second variable?

- The above link also says "`P(x) = Q(y) = 0`". Does it mean that `p` and `q` can't be both `Poly((x-1)*(x-2)*(x-3)*(x-4))`? What if I would like to add the same two numbers?

Thank you very much in advance!

Kalevi Suominen

unread,
Jan 4, 2017, 2:03:34 PM1/4/17
to sympy


On Wednesday, January 4, 2017 at 6:25:02 PM UTC+2, ecir...@gmail.com wrote:
I have two algebraic numbers defined by minimal polynomials:

    x, z = symbols('x, z')
    p = Poly((x-1)*(x-2)*(x-3)*(x-4))
    q = Poly((x-5)*(x-6)*(x-7)*(x-8))

and I would like to compute the sum of these numbers. I [found](http://math.stackexchange.com/a/155132/327863) that I need to "`z=x+y` is a root of the resultant of `P(x)` and `Q(z−x)` (where we take this resultant by regarding `Q` as a polynomial in only `x`)".

I'm totally new to all this algebraic numbers thing so I don't quite understand the advice but I tried:

    resultant(p, q.subs(x, z-x))

The resultant is used to eliminate one variable which has to be given as an argument. So this is what you want:

       resultant(p, q.subs(x, z - x), x)

ecir...@gmail.com

unread,
Jan 4, 2017, 2:13:56 PM1/4/17
to sympy

On Wednesday, January 4, 2017 at 8:03:34 PM UTC+1, Kalevi Suominen wrote:


The resultant is used to eliminate one variable which has to be given as an argument. So this is what you want:

       resultant(p, q.subs(x, z - x), x) 

Thanks!
 

Aaron Meurer

unread,
Jan 4, 2017, 6:23:57 PM1/4/17
to sy...@googlegroups.com
Is there a typo below? Those polynomials aren't minimal polynomials because they aren't irrreducible. 

Aaron Meurer 

--


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+un...@googlegroups.com.


To post to this group, send email to sy...@googlegroups.com.


Visit this group at https://groups.google.com/group/sympy.


To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/1ed9b3a3-d5cf-4343-9674-99560c14400f%40googlegroups.com.


For more options, visit https://groups.google.com/d/optout.


ecir...@gmail.com

unread,
Jan 5, 2017, 6:08:22 AM1/5/17
to sympy
No, not a typo but an oversight from me.

Is a polynomial "irreducible" if `factor_list(Poly(...))` is exactly of length 1?

Kalevi Suominen

unread,
Jan 5, 2017, 6:24:52 AM1/5/17
to sympy


On Thursday, January 5, 2017 at 1:08:22 PM UTC+2, ecir...@gmail.com wrote:
No, not a typo but an oversight from me.

Is a polynomial "irreducible" if `factor_list(Poly(...))` is exactly of length 1?

It is irreducible if there is only one factor and its exponent is 1. The square of an irreducible polynomial is not irreducible.

Aaron Meurer

unread,
Jan 5, 2017, 4:52:49 PM1/5/17
to sy...@googlegroups.com
You can also check p.is_irreducible. And to be clear, yes, the factors
from factor_list are guaranteed to be irreducible.

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/d47d09c1-4afb-40b3-a13c-9a971057cc18%40googlegroups.com.

ecir...@gmail.com

unread,
Jan 5, 2017, 5:07:58 PM1/5/17
to sympy
Understood, thank you all!
Reply all
Reply to author
Forward
0 new messages