def r(v,d,q):
if d > v*(q-1):
r = d % q
m = (d-r)/q
run = False
return r, m, run
print('The chosen degree,', d ,',is too big for',v, 'variables and',q,'order and cycles your polynomial back to returns a smaller polynomial')
print('_____________________________________')
else:
r = d % (q-1)
m = (d-r)/(q-1)
run = True
return r, m, run
def C(v,d,l= None):
if l == None:
l = v
term = 0
i=0
for i in range(1, min (d,v,l) +1):
z = v-i
numiz= binomial (d-1,d-1) *binomial (v,z)
term=term+numiz
print("For", i, "nonzero degrees and", z, "zero degrees, there are", numiz, "terms.")
i=i+1
if i == min(d,v,l)+1:
print("Using", v, "variables over", d, "degrees and sequence length of", l, ",", term, "is the total number of possible terms using", min(v,l), "variables.")
return term
def C_st(v,d,q,l=None):
term_val = C(v,d,l)
r_val, m_val, run_val = r(v,d,q)
if run_val == False:
print('I told you it doesnt work!')
elif run_val == True:
adj_terms = binomial(v,m_val)* term_val
print(adj_terms,'is the total number of terms adjusted for cycles!')
C_st(4,4,2)