On 25 Apr., 12:50, Santanu Sarkar <[email protected]>
wrote:
> Sorry again. Dependency needs over integer.

Probably there is a better way of doing it, but the following works:

Transform the problem into a matrix: One row for each polynomial, one
column for each monomial that occurs in one of the polynomials, and
the entries given by the coefficient of a monomial in a polynomial.

Hence:
sage: R.<x1,x2,x3>=ZZ[]
sage: f1=1+x1+x2+x1*x2
sage: f2=1+x1+x3+x1*x3
sage: P = [f1, f2, f1*f2, x1*f2, x2*f2]  # the list of polynomials
sage: V = list(set(sum([p.monomials() for p in P],[]))) # the list of
all occuring monomials
sage: V
[1, x1*x2*x3, x1*x3, x1*x2, x1, x1^2, x3, x2, x1^2*x2, x1^2*x3, x2*x3,
x1^2*x2*x3]
sage: p_to_dict = lambda p: dict([(x[1],x[0]) for x in list(p)]) # an
auxiliary function
sage: D = [p_to_dict(p) for p in P]  # list of dictionaries providing
the coefficients
sage: M = Matrix(ZZ, [[d.get(m,0) for m in V] for d in D])
sage: M
[1 0 0 1 1 0 0 1 0 0 0 0]
[1 0 1 0 1 0 1 0 0 0 0 0]
[1 2 2 2 2 1 1 1 1 1 1 1]
[0 0 1 0 1 1 0 0 0 1 0 0]
[0 1 0 1 0 0 0 1 0 0 1 0]
sage: M.kernel()
Free module of degree 5 and rank 0 over Integer Ring
Echelon basis matrix:
[]

So, no linear dependency.

But, as I said, I would expect that it can be done better, and I even
don't know if the above transformations are efficiently done.

Cheers,
Simon

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to