Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question
1

Monomial with power modulo n

asked 4 years ago

only1sale gravatar image

I need to implement the following formal structure axγ,γZ/nZ,aR and x is a formal variable.

I tried

ZZ6 = Integers(6) x = var('x') x^ZZ6(9) + x^ZZ6(11)

And get value x^8, whereas I need x^ZZ6(8).

How can I do this in sage?

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
2

answered 4 years ago

tmonteil gravatar image

You can make a polynomial quotient ring:

sage: R.<x> = RR[]
sage: R
Univariate Polynomial Ring in x over Real Field with 53 bits of precision
sage: S = R.quotient(x^6-1)
sage: S
Univariate Quotient Polynomial Ring in xbar over Real Field with 53 bits of precision with modulus x^6 - 1.00000000000000
sage: S.inject_variables()
Defining xbar

Then, you can do

sage: xbar^9 + xbar^11
xbar^5 + xbar^3
sage: xbar^9 * xbar^11
xbar^2

Also, if your coefficients turn out to be rational, i would sugest to define sage: R.<x> = QQ[]

Preview: (hide)
link

Comments

Thanks a lot! This is exactly what I needed.

only1sale gravatar imageonly1sale ( 4 years ago )

This solution has the drawback of introducing an inexact ring in otherwise exact computations...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 4 years ago )

@emmanuel-charpentier : i used RR to stay close to @only1sale question, I then explained that QQ could be used otherwise, i do not get your point.

tmonteil gravatar imagetmonteil ( 4 years ago )
2

answered 4 years ago

FrédéricC gravatar image

another way

sage: R = Zmod(6)
sage: A = R.algebra(QQ,category=CommutativeAdditiveSemigroups())
sage: x = A.gens()[1]
sage: 3*x+x**4
3*B[1] + B[4]
sage: _**4
120*B[1] + 136*B[4]
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 4 years ago

Seen: 392 times

Last updated: Jun 09 '20