Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Code Samples

169 views
unlisted
ubuntu2204
#How many terms of k degree and v variables # Let P(k,v) be the homogeneous polynomial of v variables, k degrees, with nonzero coefficients #i is the sequence length (ie: number of nonzero exponents) #l is the max sequence length (defined or defaulted to v #d is degree, geq 1 #v is number of vari, geq 1 def C(v,d,l= None): if l == None: l = v print(l) term = 0 for i in range(1, min (d,v,l) +1): #z is the number of "0" degrees, for padding purposes z = v-i # first bit is the unpadded, second is multiply by the padding options numiz= binomial (d-1,d-1) *binomial (v,z) #term is number of…terms 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.") C(6,3)