Not able to generate a simple list of polynomial. I am getting list of list.
def quad_polynomial(field, n,m):
Polynomial_Ring1=PolynomialRing(K,['x%s'%p for p in range(1,n+1)])
x1=Polynomial_Ring1.gens()
gen_Polynomial_Ring1 = matrix(x1)
list_of_quadratic_part=[0 for i in range(m)]
for i in range(m):
list_of_quadratic_part[i]=gen_Polynomial_Ring1*(random_matrix(K,n))*gen_Polynomial_Ring1.transpose()
#print(list_of_quadratic_part[i])
return list_of_quadratic_part
The output I am getting is like this:
quad_polynomial(K,2,3)
[[x1*x2 + (a + 1)*x2^2], [x1^2 + (a + 1)*x1*x2], [x1^2 + (a + 1)*x2^2]]
It is giving me list of list. I want a output like
[x1*x2 + (a + 1)*x2^2, x1^2 + (a + 1)*x1*x2, x1^2 + (a + 1)*x2^2]
How can I do it?
You can use
parent(t)
to know in whatt
lives. In your case, each element of the list is a matrix.not sure I understand the question , Sorry if I dont !.