Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Making a constant a variable in a polynomial

Hi, I have a multi-variable polynomial whose coefficients are algebraic numbers. For a start, I want to convert it into a single - variable polynomial whose variable is the constant - algebraic number. Here is a simple example.

Q.<x>=QQ[]

F.<r>=NumberField(x^2-2) # this is the field of the coefficients of a polynomial, just allowed to be r or 2

R.<x,y,z,t> =PolynomialRing(F)

P=sum( [ R.gens()[i] * r^i for i in range(4) ] ); # P = x + r* y +r^2 * z + r^3 * t

The output is: P(x,y,t) = x + (r)y + 2z + (2r)*t

I would like to get P(r) = (y + 2t) * r + (x+2*t)

Making a constant a variable in a polynomial

Hi, I have a multi-variable polynomial whose coefficients are algebraic numbers. For a start, I want to convert it into a single - variable polynomial whose variable is the constant - algebraic number. Here is a simple example.

Q.<x>=QQ[]

Q.<x>=QQ[]
F.<r>=NumberField(x^2-2)    # this is the field of the coefficients of a polynomial, just allowed to be r or 2

2 R.<x,y,z,t> =PolynomialRing(F)

R.<x,y,z,t> =PolynomialRing(F)

P=sum( P = sum( [ R.gens()[i] * r^i for i in range(4) ] ); # P = x + r* y +r^2 * z + r^3 * t

The output is: P(x,y,t) = x + (r)y + 2z + (2r)*t

I would like to get P(r) = (y + 2t) * r + (x+2*t)

Making a constant a variable in a polynomial

Hi, I have a multi-variable polynomial whose coefficients are algebraic numbers. For a start, edited my question and put the answer I found, so this solves my problem!

My problem was: take a field " E " generated by " r " (here, "r" is a root of X^3 - 2 ) and 3 variables " b0 , b1 , b2 ".

I want to convert it into a single - variable polynomial whose variable is the constant - algebraic number. Here is a simple example.

Q.<x>=QQ[]
F.<r>=NumberField(x^2-2)    # this is the produce the element  " A = b0 + r * b1 + r^2 * b2 "  and it's square:

A^2 = b0^2 + (2r) * b0 * b1 + (r^2) * b1^2 + (2r^2) * b0 * b2 + 4 * b1 * b2 + (2*r) * b2^2

and express A and A^2 in terms of the basis "( 1 , r , r^2 )" so that the result becomes:

A^2 = r^2 ( b1^2 + 2 b0 * b2 ) + r ( 2 b0 * b1 + 2 b2^2 ) + ( b0^2 + b2^2 + b1 * b2 )

The solution was simply to define the number field of the as an extension of the ring of coefficients of a polynomial, just allowed to be r or 2 R.<x,y,z,t> =PolynomialRing(F)

P = sum( [ R.gens()[i] and the other way round! Good!

B=PolynomialRing(E,3,'b');

v=B.gens()

E.<r>=B.extension(x^3-2)

A^2=sum( [v[i] * r^i for i in range(4) range(3) ] ); # P = x + r* y +r^2 * z + r^3 * t

The output is: P(x,y,t) = x + (r)y )

gives me the solution:

(b1^2 + 2z + (2r)*t

I would like to get P(r) = (y + 2t) * r + (x+2*t)b0b2)r^2 + (2b0b1 + 2b2^2)r + b0^2 + 4b1*b2

result expressed in terms of powers of "r".

Making a constant a variable Variables in a polynomial

I edited my question and put the answer I found, so this solves my problem!

My problem was: take a field " E " generated by " r " (here, "r" is a root of X^3 - 2 ) and 3 variables " b0 , b1 , b2 ".

I want to produce the element " A = b0 + r * b1 + r^2 * b2 " and it's square:

A^2 = b0^2 + (2r) * b0 * b1 + (r^2) * b1^2 + (2r^2) * b0 * b2 + 4 * b1 * b2 + (2*r) * b2^2

and express A and A^2 in terms of the basis "( 1 , r , r^2 )" so that the result becomes:

A^2 = r^2 ( b1^2 + 2 b0 * b2 ) + r ( 2 b0 * b1 + 2 b2^2 ) + ( b0^2 + b2^2 + b1 * b2 )

The solution was simply to define the number field as an extension of the ring of coefficients and the other way round! Good!

B=PolynomialRing(E,3,'b');

v=B.gens()

E.<r>=B.extension(x^3-2)

A^2=sum( [v[i] * r^i for i in range(3) ] )

gives me the solution:

(b1^2 + 2b0b2)r^2 + (2b0b1 + 2b2^2)r + b0^2 + 4b1*b2

result expressed in terms of powers of "r".