Ask Your Question

Nathan's profile - activity

2020-02-01 12:55:56 +0200 received badge  Good Question (source)
2016-12-03 15:35:15 +0200 received badge  Nice Question (source)
2013-11-12 23:17:04 +0200 received badge  Famous Question (source)
2013-09-02 07:15:47 +0200 received badge  Famous Question (source)
2013-02-21 11:00:50 +0200 received badge  Student (source)
2013-01-25 18:13:58 +0200 received badge  Notable Question (source)
2012-11-20 09:59:04 +0200 received badge  Notable Question (source)
2012-09-26 15:36:32 +0200 received badge  Popular Question (source)
2012-06-17 14:14:44 +0200 received badge  Popular Question (source)
2011-10-17 13:04:18 +0200 received badge  Supporter (source)
2011-10-17 12:16:43 +0200 asked a question Creating an array of variables

Here is a very very basic question.

I want to create a polynomial, say a_0x^0 + a_1x + a_2*x^2+ \cdots + a_{20} x^{20}.

I could define these a_i one at a time, but it would be much better to have a way to create an array A of length 20 where A[i] is the coefficient a_i. The idea is that I want to do some operations and solve for these coefficients, which will end up being rational numbers.

There must be some very basic command that I don't know, but I can't find it in the documentation.

2011-10-07 15:51:56 +0200 commented answer Finding integer solutions to systems of polynomial equations

I have tried using assume(a,'integer) but a still seems to be in the Symbolic Ring. It still gives me an answer for a which is often not an integer for different values of A and B.

2011-10-07 12:52:03 +0200 asked a question 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?