[Algcomp2020] diviosn polinomios

Alvaro Rittatore alvaro at cmat.edu.uy
Thu Sep 10 17:11:43 -03 2020


R.<x>=PolynomialRing(QQ)

def divi(p,q):
#no dividas entre 0
 if q==0:
    return("NaN")
 elif q!=0:
    l=0
    r=R(p)
    q=R(q)
    while r!=0 and q.degree()<=r.degree():
        t=r.leading_coefficient()/q.leading_coefficient()
        m=x^(r.degree()-q.degree())
        l=l+t*m
        r=r-(t*m*q)
        print(l,r)
    return(l,r)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.cmat.edu.uy/pipermail/algcomp2020/attachments/20200910/6c630622/attachment.html>


More information about the Algcomp2020 mailing list