# On power residue symbol

I computed sum of power residue symbol in N th cyclotomic field:

def new_residue_symbol(a,P,N):
if a not in P:
return K(a).residue_symbol(P,N)
else:
return 0
N=3
K.<z>=CyclotomicField(N)
p=5
P =(K.ideal(p).factor())[0][0]#P is prime ideal above p
sum(new_residue_symbol(a,P,N) for a in P.residue_field())


This must be $0$ but sage put error typeerror: unable to convert 0 to Cyclotomic Field of order 3 and degree 2. How can I fix this? (When you change $p=7$, then sage put $0$. This might be lifting problem of representatives of residue field )

edit retag close merge delete

Sort by » oldest newest most voted

UPDATED. Per clarifications from DaveWitteMorris the code should use not a.is_zero() instead of a not in P, and a.parent().lift_map()(a) instead of K(a):

def new_residue_symbol(a,P,N):
Ka = a.parent().lift_map()(a)
return Ka.residue_symbol(P,N) if not a.is_zero() else 0

more

I reported https://github.com/sagemath/sage/issues/36734 (there), but that’s not a bug.

( 2023-11-21 07:14:07 +0200 )edit

I see.. You can post a corrected code here as an answer to your own question, to save it for future references. I'll then remove mine.

( 2023-11-21 13:03:57 +0200 )edit

If you don’t mind, you can edit your answer with some description. Your answer will be better than mine :).

( 2023-11-22 06:44:40 +0200 )edit

@Ys1123: Done!

( 2023-11-23 14:45:31 +0200 )edit