Hi, everyone.
I'm an old user of GP and a very raw beginner when it comes to Sage, so please forgive the naiveté!
For a new edition of my book on the p-adics I am trying to add pointers to how to do things on a computer with p-adic numbers. Everything in the book is very elementary, so I'd like to avoid complications and use only short bits of code that can be computed with the Sage Cell Server.
So, for the section on Hensel's Lemma I want to know how to find an approximate p-adic root of a polynomial. In GP, this is padicappr(pol,a), where pol is a polynomial and a is a p-adic number which is a root mod p. Is there anything like that in Sage?
Fernando
Thanks to both Vincent and Nils!
Sage seems to include lots of ways to do things... Let me see if I understand. Vincent suggested
R = PolynomialRing(Qp(7), 'x')
x = R.gen()
p = x^2 - 2
pari.padicappr(p, 4 + O(7^10))
Which works, but relies on using the built-in pari support; on the cell server, one might as well switch to GP mode.
Nils suggested (essentially)
K=pAdicField(7)And that also works, returning (line break added)
4 + 5*7 + 4*7^2 + 5*7^4 + 4*7^5 + 5*7^6 + 4*7^7 + 2*7^8 + 4*7^11 + 5*7^12 + 5*7^13 + 6*7^14 + 4*7^15 + 5*7^16 + 5*7^17 + 2*7^18 + O(7^20)
Meaning 20 is the default precision.
I guess hensel_lift is the function I was looking for. And
writing K[x](x^2-2) tells Sage that the polynomial is to be
considered as having coefficients in Qp
Questions:
Do Qp(7) and pAdicField(7) do the same thing?
K[x] and K['x'] seem to do the same thing as well. Is that right?
But if I use y or 'y' it doesn't work unless I define y in
advance. (Which I'll have to figure out how to do... )
Thanks,
Fernando
-- ============================================================= Fernando Q. Gouvea http://www.colby.edu/~fqgouvea Carter Professor of Mathematics Dept. of Mathematics and Statistics Colby College 5836 Mayflower Hill Waterville, ME 04901 [Nuclear war] ... may not be desirable. -- Edwin Meese III
Questions:
Do Qp(7) and pAdicField(7) do the same thing?
K[x] and K['x'] seem to do the same thing as well. Is that right?