Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Finding integer solutions to systems of polynomial equations

Hi,

I am trying to do something very simple but have been struggling.

Here is a simplified example that I can't get to work. I want to define polynomials with integer coefficients, say f(A,B) = A+B, g(A,B) = aA+bB, where I want to assume that a and b are intgers. I want the solver to give me the values of a and b so that f-g is equal to zero as a polynomial in A and B. So, I want it to give me a== 1, b== 1.

I have tried something like this-

R.< A,B > = ZZ[]

f = A+B

var('a', domain = ZZ)

var('b', domain = ZZ)

g = aA+bB

solve(f-g==0,a,b),

but what it gives me is [a == -((b-1)*B-A)/A, [1]].

How do I define variables a and b which are integers, but unknown integers? No matter what I seem to do, they are put in Symbolic Ring. How do I get the solve command to give me integer solutions to a set of linear equations?

Finding integer solutions to systems of polynomial equations

Hi,

I am trying to do something very simple but have been struggling.

Here is a simplified example that I can't get to work. I want to define polynomials with integer coefficients, say

f(A,B) = A+B, 
g(A,B) = aA+bB,
a*A+b*B

where I want to assume that a and b are intgers. integers. I want the solver to give me the values of a and b so that f-g is equal to zero as a polynomial in A and B. So, I want it to give me a== 1, b== 1.

I have tried something like this-

R.< A,B > = ZZ[]

ZZ[] f = A+B

A+B var('a', domain = ZZ)

ZZ) var('b', domain = ZZ)

ZZ) g = aA+bB

solve(f-g==0,a,b),

a*A+b*B solve(f-g==0,a,b),

but what it gives me is [a == -((b-1)*B-A)/A, [1]].[1]].

How do I define variables a and b which are integers, but unknown integers? No matter what I seem to do, they are put in Symbolic Ring. How do I get the solve command to give me integer solutions to a set of linear equations?