On 09/11/2010 11:30 PM, john_perry_usm wrote:
> I would try this:
> 
> 1. Let M be an augmented matrix over the *integer* ring whose entries
> in the left block are (as you state) the coefficients of p_1*p_2, ...
> p_i*p_j. You can create a matrix over the integer ring using M =
> matrix(ZZ,...).
> 
> 2. Echelonize the matrix: M.echelonize().
> 
> 3. See if you can back-substitute from the echelon form to an integer
> solution.
> 
> For example,
> 
> sage: M = matrix(ZZ,[[1,2,3,4,11],[0,1,2,3,6],[0,0,2,3,5],
> [0,0,0,1,1]])
> sage: M.echelonize()
> sage: M
>>> [1 0 1 0 3]
>>> [0 1 0 0 1]
>>> [0 0 2 0 2]
>>> [0 0 0 1 1]
> sage: M = matrix(ZZ,[[1,2,3,4,11],[0,1,2,3,6],[0,0,2,3,4],
> [0,0,0,1,1]])
> sage: M.echelonize()
> sage: M
>>> [1 0 1 0 3]
>>> [0 1 0 0 1]
>>> [0 0 2 0 1]
>>> [0 0 0 1 1]
> 
> Notice that in the second echelon form, the third row implies 2*x3 ==
> 1. In the first, we have 2*x3 == 2 instead.
> 
> There's probably a much, much better way to do this, but that's all I
> can think of offhand.


Could it help to cast the problem as a linear program and to try to
solve that?

How many terms does q have, typically?


> On Sep 9, 1:34 am, Cary Cherng <[email protected]> wrote:
>> Suppose I form the row matrix: M = [ (p_1*p_2, .., p_i*p_j) ] and then
>> try looking for a column vector x satifying M*x = q where the elements
>> of x are integers, hopefully 1 or -1. If I tried this approach how
>> would I get sage to only consider integer vectors x as solutions.
>>
>> On Sep 8, 6:20 am, john_perry_usm <[email protected]> wrote:
>>
>>> Are you asking whether q=p_1*p_2+...+p_5*p_6? If so, you can simply
>>> construct q and the p_i, then test for equality:
>>
>>> sage: q == p_1*p_2 + ... + p_5*p_6
>>
>>>>> True (or False, depending)
>>
>>> (you would fill in the ellipsis with the form you want, which is not
>>> obvious to me from what you've written).
>>
>>> If instead you want to know if q is *some* linear combination of
>>> p_1*p_2, ..., p_5*p_6 then you could use either linear algebra (I
>>> think) or some slightly more sophisticated commutative algebra (e.g.,
>>> a Groebner basis, but that might be more than you need for this
>>> specific case).
>>
>>> regards
>>> john perry
>>
>>> On Sep 8, 1:57 am, Cary Cherng <[email protected]> wrote:
>>
>>>> I am not familiar with algebraic geometry or its terminology and new
>>>> to sage.
>>
>>>> p_1,...p_n and q are elements of Z[x_1,...,x_n]. In my context I have
>>>> some evidence that q can be written as something like q = p_1*p_2
>>>> + ... + p_5*p_6. In other words q is a degree 2 polynomial in the
>>>> p_i's. Can Sage find out if q can be written in terms of the p_i's?
> 

-- 
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