def dup_sturm(f, K):
 if (not K.has_Field):
  raise DomainError(("can't compute Sturm sequence over %s" % K))
 f = dup_sqf_part(f, K)
 sturm = [f, dup_diff(f, 1, K)]
 while sturm[(-1)]:
  s = dup_rem(sturm[(-2)], sturm[(-1)], K)
  sturm.append(dup_neg(s, K))
 return sturm[:(-1)]

def dup_sturm ( f , K ) : if ( not K . has_Field ) : raise DomainError ( ( "can't compute Sturm sequence over %s" % K ) ) f = dup_sqf_part ( f , K ) sturm = [ f , dup_diff ( f , 1 , K ) ] while sturm [ ( - 1 ) ] : s = dup_rem ( sturm [ ( - 2 ) ] , sturm [ ( - 1 ) ] , K ) sturm . append ( dup_neg ( s , K ) ) return sturm [ : ( - 1 ) ]
computes the sturm sequence of f in f[x] .