### 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~~

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

$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$$ *p + 8$

* **and *~~$$B=9~~

$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)$$.~~48p + 9)$.

I have checked using multiple software that the factorization of D using the quartic in $p$ ~~$$v^2= ~~

$v^2= p^4-2*p^3+5*~~p^2+8~~*p+4$$ **p^2+8*p+4$ gives *~~$$[M-((A+2~~

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

$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$$.~~p-2$.

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