import numpy #The following code defines a function which gives the catalecticant matrix #Input: ## F: a form ## deg: the source degree of the catalecticant ## vars: a list of the variables in F ## Fdeg: the degree of F #Output: a matrix for the catalecticant map from S_(deg) to S_(Fdeg-deg), along with the basis used for #S_(deg) and S_(Fdeg-deg) def catalecticant(F,deg,vars,Fdeg): K = parent(F.coefficient(vars[0])) n = len(vars) sourceVectors = list(IntegerVectors(deg,n)) sourceVarVec = [[[vars[i],v[i]] for i in range(n)] for v in sourceVectors] diffList = [] for df in sourceVarVec: diffString = 'diff(F,' for i in range(len(df)): diffString+=str(df[i][0])+',' diffString+=str(df[i][1]) if i