macsyma on Fri, 09 Aug 2019 05:05:58 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: gcd |
Thank you, Bill. > in some common number field: I'm sorry, I want to make the degree of the defining polynomial as low as possible. > (depending on what you are really interest in) My (sub)goal is "For a given irreducible g in Q[x], to find any one factor of g over the algebraic number field defined by polcyclo(p_1),...,polcyclo(p_m) where {p_1,...,p_m} is all of the odd prime factors of poldegree(g)." and test01() is an implementation to do that. tst01(gx) = { my(L = select(r -> r - 2, factor(poldegree(gx))[, 1]), p, q, s, t, u, M, N = gx); for(i = 1, #L, q = polcyclo(p = L[i], u = eval(concat("c", p))); [s, t] = nfsubfields(q)[-2..-2][1]; M = nffactor(q, subst(liftpol(nffactor(s, gx)[1, 1]), u, t))[1, 1]; N = gcd(N, M)); liftpol(N / pollead(N)) }; In my experiments, only tst01(nfsplitting(x^35-2)) doesn't work well, and the cause seems to be a malfunction of gcd() I posted. > PARI is not well suited to compute gcd of multivariate polynomials. Even with the following simple method, the correct result can be obtained, so I posted in the hope that some modification will make gcd() work well. while(Q=P%(R=Q),P=R);liftpol(R/pollead(R)) %4 = x^35+((-2814705810*c7^5-12865509020*c7^4-2956013550*c7^3+6832839580*c7^2-3002993630*c7-7609289760)*c5^3+(-11072532380*c7^5-12027706250*c7^4-2118210780*c7^3-1424986990*c7^2-3002993630*c7+1673794090)*c5^2+(-1236699170*c7^5-11980726170*c7^4-11980726170*c7^3-1236699170*c7^2-2932502040)*c5+(-9449209994*c7^5-18890856012*c7^4-9081390038*c7^3-7779009056*c7^2-15991519880*c7-9462010960)) macsyma