Logging to /Users/s/tmp/pari-26.05 GPRC Done. GP/PARI CALCULATOR Version 2.12.1 (development 25142-46eb34041) i386 running darwin (x86-64/GMP-6.2.0 kernel) 64-bit version compiled: Mar 22 2020, Apple clang version 11.0.0 (clang-1100.0.33.17) threading engine: single (readline v8.0 enabled, extended help enabled) Copyright (C) 2000-2020 The PARI Group PARI/GP is free software, covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY WHATSOEVER. Type ? for help, \q to quit. Type ?17 for how to get moral (and possibly technical) support. parisizemax = 900001792, primelimit = 1000000 (02:53) gp > 6000/2.7 %1 = 2222.2222222222222222222222222222222222 (02:53) gp > %/60 %2 = 37.037037037037037037037037037037037037 Logging to /Users/s/tmp/pari-26.05 GPRC Done. GP/PARI CALCULATOR Version 2.12.1 (development 25142-46eb34041) i386 running darwin (x86-64/GMP-6.2.0 kernel) 64-bit version compiled: Mar 22 2020, Apple clang version 11.0.0 (clang-1100.0.33.17) threading engine: single (readline v8.0 enabled, extended help enabled) Copyright (C) 2000-2020 The PARI Group PARI/GP is free software, covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY WHATSOEVER. Type ? for help, \q to quit. Type ?17 for how to get moral (and possibly technical) support. parisizemax = 900001792, primelimit = 1000000 (16:48) gp > ?newtonpoly newtonpoly(x,p): Newton polygon of polynomial x with respect to the prime p. (16:48) gp > ??newtonpoly newtonpoly(x,p): Gives the vector of the slopes of the Newton polygon of the polynomial x with respect to the prime number p. The n components of the vector are in decreasing order, where n is equal to the degree of x. Vertical slopes occur iff the constant coefficient of x is zero and are denoted by +oo. The library syntax is GEN newtonpoly(GEN x, GEN p). (16:48) gp > ??newtonpoly newtonpoly(x,p): Gives the vector of the slopes of the Newton polygon of the polynomial x with respect to the prime number p. The n components of the vector are in decreasing order, where n is equal to the degree of x. Vertical slopes occur iff the constant coefficient of x is zero and are denoted by +oo. The library syntax is GEN newtonpoly(GEN x, GEN p). (16:48) gp > x=(y+1)^ *** syntax error, unexpected $end: x=(y+1)^ *** ^- (16:49) gp > ?polcyclo polcyclo(n,{a = 'x}): n-th cyclotomic polynomial evaluated at a. (16:49) gp > polcyclo(7) %1 = x^6 + x^5 + x^4 + x^3 + x^2 + x + 1 (16:49) gp > polcyclo(5) %2 = x^4 + x^3 + x^2 + x + 1 (16:49) gp > polcyclo(3) %3 = x^2 + x + 1 (16:49) gp > polcyclo(2) %4 = x + 1 (16:49) gp > polcyclo(4) %5 = x^2 + 1 (16:49) gp > polcyclo(6) %6 = x^2 - x + 1 (16:50) gp > eulerphi(12) %7 = 4 (16:50) gp > polcyclo(12) %8 = x^4 - x^2 + 1 (16:50) gp > polcyclo(7) %9 = x^6 + x^5 + x^4 + x^3 + x^2 + x + 1 (16:51) gp > subst(%,x,y+1) %10 = y^6 + 7*y^5 + 21*y^4 + 35*y^3 + 35*y^2 + 21*y + 7 (16:51) gp > Mod(%,7) %11 = Mod(1, 7)*y^6 (16:51) gp > ?newtonpoly newtonpoly(x,p): Newton polygon of polynomial x with respect to the prime p. (16:51) gp > newtonpoly(%10,7) %12 = [1/6, 1/6, 1/6, 1/6, 1/6, 1/6] (16:51) gp > ?newtonpoly newtonpoly(x,p): Newton polygon of polynomial x with respect to the prime p. (16:51) gp > ??newtonpoly newtonpoly(x,p): Gives the vector of the slopes of the Newton polygon of the polynomial x with respect to the prime number p. The n components of the vector are in decreasing order, where n is equal to the degree of x. Vertical slopes occur iff the constant coefficient of x is zero and are denoted by +oo. The library syntax is GEN newtonpoly(GEN x, GEN p). (16:51) gp > ???newtonpoly newtonpoly (16:52) gp > newtonpoly(x^4+4*x^3+16*x+2,2) %13 = [1/4, 1/4, 1/4, 1/4] (16:52) gp > newtonpoly(x^4+4*x^3+16*x+2^10,2) %14 = [6, 4/3, 4/3, 4/3] (16:52) gp > ?polresultant polresultant(x,y,{v},{flag=0}): resultant of the polynomials x and y, with respect to the main variables of x and y if v is omitted, with respect to the variable v otherwise. flag is optional, and can be 0: default, uses either the subresultant algorithm, a modular algorithm or Sylvester's matrix, depending on the inputs; 1 uses Sylvester's matrix (should always be slower than the default). (16:54) gp > ??polresultant polresultant(x,y,{v},{flag = 0}): Resultant of the two polynomials x and y with exact entries, with respect to the main variables of x and y if v is omitted, with respect to the variable v otherwise. The algorithm assumes the base ring is a domain. If you also need the u and v such that x*u + y*v = Res(x,y), use the polresultantext function. If flag = 0 (default), uses the algorithm best suited to the inputs, either the subresultant algorithm (Lazard/Ducos variant, generic case), a modular algorithm (inputs in Q[X]) or Sylvester's matrix (inexact inputs). If flag = 1, uses the determinant of Sylvester's matrix instead; this should always be slower than the default. If x or y are multivariate with a huge polynomial content, it is advisable to remove it before calling this function. Compare: ? a = polcyclo(7) * ((t+1)/(t+2))^100; ? b = polcyclo(11)* ((t+2)/(t+3))^100); ? polresultant(a,b); time = 3,833 ms. ? ca = content(a); cb = content(b); \ polresultant(a/ca,b/cb)*ca^poldegree(b)*cb*poldegree(a); \\ instantaneous The function only removes rational denominators and does not compute automatically the content because it is generically small and potentially very expensive (e.g. in multivariate contexts). The choice is yours, depending on your application. The library syntax is GEN polresultant0(GEN x, GEN y, long v = -1, long flag) where v is a variable number. (16:54) gp > polresultant(x^6-1,x^4-1) %15 = 0 (16:54) gp > polresultant(x+2,x-3) %16 = -5 (16:55) gp > polresultant(x^2+1,x^2-2) %17 = 9 (16:56) gp > polresultant(x^2+1,x^3-2) %18 = 5 (16:56) gp > polresultant(x^2+1,x^3-3) %19 = 10 (16:56) gp > factor(%) %20 = [2 1] [5 1] (16:56) gp > factormod(x^2+1,5) %21 = [Mod(1, 5)*x + Mod(2, 5) 1] [Mod(1, 5)*x + Mod(3, 5) 1] (16:56) gp > factormod(x^3-3,5) %22 = [ Mod(1, 5)*x + Mod(3, 5) 1] [Mod(1, 5)*x^2 + Mod(2, 5)*x + Mod(4, 5) 1] (16:57) gp > polresultant(x^2+y,x^3-3*y) %23 = y^3 + 9*y^2 (16:57) gp > factor(%) %24 = [ y 2] [y + 9 1] (16:58) gp > poldisc(x^2+1) %25 = -4 (16:59) gp > poldisc(x^3-x^2) %26 = 0