# Factor a quadratic in a quartic polynomial

Hi, I have done this calculation using a very tedious way and have checked that it is correct. Can I possibly perform this using Sage only.

I have a polynomial :

D=M^2-(A/(2*p^4))*M+(B/(16*p^4))


where

A=18*p^{10} - 54*p^9 + 59*p^8 + 130*p^7 - 209*p^6 - 98*p^5 + 407*p^4 + 362*p^3 + 49*p^2 - 16*p + 8


and

B=9*( p + 1 )^2*(p^4 - 2*p^3 + 2*p^2 + 2*p + 1)*(4*p^8 - 52*p^7 + 373*p^6 + 68*p^5 - 445*p^4 + 72*p^3 + 163*p^2 - 48*p+ 9).


I have checked using multiple software that the factorization of D using the quartic in $p$

v^2= p^4-2*p^3+5*p^2+8*p+4 gives

[M-((A+2*F*v)/(4*p^4))]*[M-((A-2*F*v)/(4*p^4))] where

F=9*p^8-18*p^7-7*p^6+45*p^5-21*p^4-74*p^3-18*p^2+6*p-2.

Can someone help me obtain the same result by using Sage only. Thank you.

edit retag close merge delete

1. Could you fix the formatting of your question (i. e. closing your displayed math by another pair of dollars) ? It is difficult to read you...

1. What is $M$ ?

2. Could you clarify your question ?

@emmanuel sorry for the poor display. I have corrected it. M is a rational. My question is that I want to factorize D using v so that I get [M-((A+2*F*v)/(4*p^4))]*[M-((A-2*F*v)/(4*p^4))]

Sort by » oldest newest most voted

A possibility is to start with A, B, D and ask for the roots of D, condidered as a function of degree two in M. The code is:

var( 'p,M' )
A = 18*p^10 - 54*p^9 + 59*p^8 + 130*p^7 - 209*p^6 - 98*p^5 + 407*p^4 + 362*p^3 + 49*p^2 - 16*p + 8
B = 9 \
* (p + 1)^2 \
* (p^4 - 2*p^3 + 2*p^2 + 2*p + 1) \
* (4*p^8 - 52*p^7 + 373*p^6 + 68*p^5 - 445*p^4 + 72*p^3 + 163*p^2 - 48*p+ 9)

D = M^2 - A/2/p^4*M + B/16/p^4
solutions = solve( D==0, M )
for sol in solutions:
print sol


This gives:

M == 1/4*(18*p^10 - 54*p^9 + 59*p^8 + 130*p^7 - 209*p^6 - 98*p^5 + 407*p^4 + 362*p^3 + 49*p^2
-
2*(9*p^8 - 18*p^7 - 7*p^6 + 45*p^5 - 21*p^4 - 74*p^3 - 18*p^2 + 6*p - 2)
*sqrt(p^4 - 2*p^3 + 5*p^2 + 8*p + 4) - 16*p + 8)/p^4
M == 1/4*(18*p^10 - 54*p^9 + 59*p^8 + 130*p^7 - 209*p^6 - 98*p^5 + 407*p^4 + 362*p^3 + 49*p^2
+
2*(9*p^8 - 18*p^7 - 7*p^6 + 45*p^5 - 21*p^4 - 74*p^3 - 18*p^2 + 6*p - 2)
*sqrt(p^4 - 2*p^3 + 5*p^2 + 8*p + 4) - 16*p + 8)/p^4


(Result was manually broken.)

Alternatively, one can ask for the factorization of the discriminant of D, seen as a polynomial in M. The rest is applying the formula for the roots of an equation of degree two in the variable M. A possible code for this path is:

R0.<p> = PolynomialRing( QQ )
F0 = R0.fraction_field()

R.<M> = PolynomialRing( F0 )

A = 18*p^10 - 54*p^9 + 59*p^8 + 130*p^7 - 209*p^6 - 98*p^5 + 407*p^4 + 362*p^3 + 49*p^2 - 16*p + 8
B = 9 \
* (p + 1)^2 \
* (p^4 - 2*p^3 + 2*p^2 + 2*p + 1) \
* (4*p^8 - 52*p^7 + 373*p^6 + 68*p^5 - 445*p^4 + 72*p^3 + 163*p^2 - 48*p+ 9)

D = M^2 - A/2/p^4*M + B/16/p^4

print D.discriminant().factor()
latex( D.discriminant().factor() )


This gives:

(81) * p^-8 * (p^4 - 2*p^3 + 5*p^2 + 8*p + 4) * (p^8 - 2*p^7 - 7/9*p^6 + 5*p^5 - 7/3*p^4 - 74/9*p^3 - 2*p^2 + 2/3*p - 2/9)^2


The discriminant has thus in its factorization the posted factors

• v, simple factor,
• and F, with the power two.

The latex print for the factorized discriminant is displayed here, also after some small change, as follows: $$\left(81\right) \cdot p^{-8} \cdot (p^{4} - 2 p^{3} + 5 p^{2} + 8 p + 4) \cdot \left(p^{8} - 2 p^{7} - \frac{7}{9} p^{6} + 5 p^{5} - \frac{7}{3} p^{4} - \frac{74}{9} p^{3} - 2 p^{2} + \frac{2}{3} p - \frac{2}{9} \right)^{2} \ .$$ (Use the $81=9^2$ for the squared factor to get the posted F.)

more

This is great. Exactly what I was looking for except that mine is done 3 pages long (hand written). Thank you so much.

Thank you for this command too : latex( D.discriminant().factor() ). Never knew Sage could do this. I learned a lot about Sage from this page. It is so helpful.