How do I specify that I want a polynomial to be thought of as having coefficients in a given ring $R$ in SAGE?
Separately, if I give SAGE a polynomial, how do I have it solve that equation over a certain ring $R$?
Is there a way to compute $n$th roots in the $p$-adic numbers of some given fixed $p$-adic number without using the answers to 1) and 2) above (i.e. without explicitly having SAGE solve an equation)? The ^(1/n) command does not seem to be working, for example, here (trying various primes in place of 7):
R = Qp(2, prec = 10, type = 'capped-rel', print_mode = 'series')
a = R(7)
a^(1/3)
-
$\begingroup$ I neither downvoted nor voted to close, but I assume the reason for those is that this not really a math but more a SAGE question. Then again, we do have a tag for that (which you used), and there seems to be no SE site for SAGE specifically. You could try to ask under the corresponding tag at StackOverflow: stackoverflow.com/questions/tagged/sage $\endgroup$– Torsten SchoenebergJun 2, 2022 at 16:22
-
2$\begingroup$ ask.sagemath.org is a website (not in the stackexchange universe) for questions about SageMath. $\endgroup$– John PalmieriJun 2, 2022 at 18:29
-
2$\begingroup$ Upvoted to make it non negative cause I feel like there's not really going to be a better alternative to finding someone who knows enough about p-adics and sage to help you out than here. $\endgroup$– MerosityJun 2, 2022 at 18:57
1 Answer
For #1:
sage: R = Integers(10)
sage: R
Ring of integers modulo 10
sage: P.<x,y,z> = PolynomialRing(R)
sage: P
Multivariate Polynomial Ring in x, y, z over Ring of integers modulo 10
For #2: it depends on the ring. If working in a polynomial ring with one variable, then f.roots()
could work. Otherwise, try f.factor()
. (I don't think either will work over $\mathbb{Z}/10\mathbb{Z}$, but they will work over $\mathbb{Z}/p\mathbb{Z}$ if $p$ is prime.)
For #3: try a.nth_root(3)
.