Ask Your Question
1

How to get the imaginary and real parts in quadratic extension?

asked 2018-01-26 11:26:15 +0100

ninho gravatar image

updated 2018-01-26 11:48:08 +0100

I have the following code segment in Sage:

proof.arithmetic(False)

p = 10354717741769305252977768237866805321427389645549071170116189679054678940682478846502882896561066713624553211618840202385203911976522554393044160468771151816976706840078913334358399730952774926980235086850991501872665651576831
assert p.is_prime()
Fp = GF(p)
R.<x> = PolynomialRing(Fp)
# The quadratic extension via x^2 + 1 since p = 3 mod 4
Fp2.<j> = Fp.extension(x^2 + 1)
v = 9207905618485976447392495823891126491742950552335608949038426615382964807887894797411491716107572732408369786142697750332311947639207321056540404444033540648125838904594907601875471637980859284582852367748448663333866077035709*j + 4651155546510811048846770550870646667630430517849502373785869664283801023087435645046977319664381880355511529496538038596466138807253669785341264293301567029718659171475744580349901553036469330686320047828171225710153655171014

Now, if I try to get the real and imaginary parts with v.real() and v.imag(), I get errors that those methods do not exist. I guess because v has some different structure and type. How can I get the imaginary and real parts here?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-01-26 14:13:15 +0100

tmonteil gravatar image

updated 2018-01-26 14:15:19 +0100

The notion of real and imaginary part are very related to the particular polynomial x^2+1, so for me it makes sense that there is no suvh method for an arbitrary field extension.

Anuway, you can turn v into a polynomial on the undeterminate j:

sage: v.parent()
Finite Field in j of size 10354717741769305252977768237866805321427389645549071170116189679054678940682478846502882896561066713624553211618840202385203911976522554393044160468771151816976706840078913334358399730952774926980235086850991501872665651576831^2

sage: P = v.polynomial()
sage: P
9207905618485976447392495823891126491742950552335608949038426615382964807887894797411491716107572732408369786142697750332311947639207321056540404444033540648125838904594907601875471637980859284582852367748448663333866077035709*j + 4651155546510811048846770550870646667630430517849502373785869664283801023087435645046977319664381880355511529496538038596466138807253669785341264293301567029718659171475744580349901553036469330686320047828171225710153655171014
sage: P.parent()
Univariate Polynomial Ring in j over Finite Field of size 10354717741769305252977768237866805321427389645549071170116189679054678940682478846502882896561066713624553211618840202385203911976522554393044160468771151816976706840078913334358399730952774926980235086850991501872665651576831 (using NTL)

Then look at its coefficients:

sage: re, im = P.coefficients(sparse=False)
sage: re
4651155546510811048846770550870646667630430517849502373785869664283801023087435645046977319664381880355511529496538038596466138807253669785341264293301567029718659171475744580349901553036469330686320047828171225710153655171014
sage: im
9207905618485976447392495823891126491742950552335608949038426615382964807887894797411491716107572732408369786142697750332311947639207321056540404444033540648125838904594907601875471637980859284582852367748448663333866077035709
edit flag offensive delete link more

Comments

Thanks, this seems to work.

ninho gravatar imageninho ( 2018-01-26 20:11:40 +0100 )edit

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: 2018-01-26 11:26:15 +0100

Seen: 327 times

Last updated: Jan 26 '18