Ask Your Question

Extension field over p-adics: how to write an element in the standard basis?

asked 2021-03-03 20:50:03 +0200

caelanritter gravatar image

Suppose we have an extension field $\mathbb{Q}_2(w)$, where $w$ is a root of $f(x) = x^3 + 4x^2 + 2$. By default, Sage represents $w^3$ as $w^3 + O(w^d)$, where $d$ is the precision. How do I get Sage to print $w^3$ out as a linear combination of the standard basis, i.e., as $-4w^2 - 2$ (with -4 and -2 written as they would be in $\mathbb{Q}_2$)?

edit retag flag offensive close merge delete


Welcome to Ask Sage! Thank you for your question.

slelievre gravatar imageslelievre ( 2021-03-03 21:58:52 +0200 )edit

Please provide code to reproduce the observed behaviour.

slelievre gravatar imageslelievre ( 2021-03-03 21:58:56 +0200 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2021-03-03 23:22:59 +0200

roed gravatar image

Here are some ways to do it:

sage: K.<a> = Qp(2).extension(x^3 +4*x^2 + 2, print_mode="terse")
sage: a^3
2097150 + 2097148*a^2 + O(a^63)
sage: K.<a> = Qp(2, print_mode='digits').extension(x^3 +4*x^2 + 2)                                                                                                                                                                       
sage: (a^3).polynomial()                                                                                                                                                                                                                 
...111111111111111111100*x^2 + ...000000000000000000000*x + ...111111111111111111110
sage: V, from_V, to_V = K.vector_space()                                                                                                                                                                                                 
sage: to_V(a^3)                                                                                                                                                                                                                          
(...111111111111111111110, ...000000000000000000000, ...111111111111111111100)

The print modes available are "series" (default), "val-unit", "terse", "digits" and "bars". When p > 2 you can also use the print_pos keyword to print using the range -(p-1)/2 .. (p-1)/2 instead of 0 .. p-1.

edit flag offensive delete link more

answered 2021-03-03 23:17:41 +0200

saraedum gravatar image

It seems you are looking for the terse printing mode:

sage: K = Qp(2, print_mode='terse')
sage: R.<x> = K[]
sage: L.<w> = K.extension(x^3 + 4*x^2 + 2)
sage: w^3
2097150 + 2097148*w^2 + O(w^63)

There's a section PRINTING in the reference manual which has more details.

edit flag offensive delete link more

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


Asked: 2021-03-03 20:50:03 +0200

Seen: 44 times

Last updated: Mar 03