def dmp_prs_resultant(f, g, u, K):
 if (not u):
  return dup_prs_resultant(f, g, K)
 if (dmp_zero_p(f, u) or dmp_zero_p(g, u)):
  return (dmp_zero((u - 1)), [])
 (R, S) = dmp_inner_subresultants(f, g, u, K)
 if (dmp_degree(R[(-1)], u) > 0):
  return (dmp_zero((u - 1)), R)
 return (S[(-1)], R)

def dmp_prs_resultant ( f , g , u , K ) : if ( not u ) : return dup_prs_resultant ( f , g , K ) if ( dmp_zero_p ( f , u ) or dmp_zero_p ( g , u ) ) : return ( dmp_zero ( ( u - 1 ) ) , [ ] ) ( R , S ) = dmp_inner_subresultants ( f , g , u , K ) if ( dmp_degree ( R [ ( - 1 ) ] , u ) > 0 ) : return ( dmp_zero ( ( u - 1 ) ) , R ) return ( S [ ( - 1 ) ] , R )
resultant algorithm in k[x] using subresultant prs .