residue_symbol test
system:sage


{{{id=34|
K.<w> = NumberField(x^2 - x + 1)
(w^2+3).residue_symbol(K.ideal(17),3)
///
-w
}}}

{{{id=35|
K.ideal(17).residue_symbol(w^2+3,3)
///
-w
}}}

{{{id=41|
K.ideal(31).residue_symbol(19,3)
///
1
}}}

{{{id=36|
[K.ideal(17).residue_symbol((w^2+3)^i,3) for i in range(0,6)]
///
[1, -w, w - 1, 1, -w, w - 1]
}}}

{{{id=37|
[K.ideal(17).residue_symbol((w^2+3)^i,6) for i in range(0,12)]
///
[1, -w + 1, -w, -1, w - 1, w, 1, -w + 1, -w, -1, w - 1, w]
}}}

{{{id=40|
P = K.primes_above(7)[0]
P.residue_symbol(w^2+1,6)
///
w
}}}

{{{id=1|
L.<z> = K.extension(x^2 - 7)
(w^2+3).residue_symbol(L.ideal(17),3)
///
w - 1
}}}

{{{id=16|
z.residue_symbol(K.ideal(17),3)
///
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_10.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ei5yZXNpZHVlX3N5bWJvbChLLmlkZWFsKDE3KSwzKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single')
  File "", line 1, in <module>
    
  File "/tmp/tmpVRCXbA/___code___.py", line 3, in <module>
    exec compile(u'z.residue_symbol(K.ideal(_sage_const_17 ),_sage_const_3 )' + '\n', '', 'single')
  File "", line 1, in <module>
    
  File "number_field_element.pyx", line 2952, in sage.rings.number_field.number_field_element.NumberFieldElement.residue_symbol (sage/rings/number_field/number_field_element.cpp:18727)
  File "/usr/local/lib/sage-4.1.1-linux-Ubuntu_9.04-i686-Linux/local/lib/python2.6/site-packages/sage/rings/number_field/number_field_ideal.py", line 1374, in residue_symbol
    if not self.is_coprime(e):
  File "/usr/local/lib/sage-4.1.1-linux-Ubuntu_9.04-i686-Linux/local/lib/python2.6/site-packages/sage/rings/number_field/number_field_ideal.py", line 2096, in is_coprime
    other = K.ideal(other)
  File "/usr/local/lib/sage-4.1.1-linux-Ubuntu_9.04-i686-Linux/local/lib/python2.6/site-packages/sage/rings/number_field/number_field.py", line 1987, in ideal
    return self.fractional_ideal(*gens, **kwds)
  File "/usr/local/lib/sage-4.1.1-linux-Ubuntu_9.04-i686-Linux/local/lib/python2.6/site-packages/sage/rings/number_field/number_field.py", line 2044, in fractional_ideal
    return self._fractional_ideal_class_()(self, gens, **kwds)
  File "/usr/local/lib/sage-4.1.1-linux-Ubuntu_9.04-i686-Linux/local/lib/python2.6/site-packages/sage/rings/number_field/number_field_ideal.py", line 1467, in __init__
    NumberFieldIdeal.__init__(self, field, gens)
  File "/usr/local/lib/sage-4.1.1-linux-Ubuntu_9.04-i686-Linux/local/lib/python2.6/site-packages/sage/rings/number_field/number_field_ideal.py", line 188, in __init__
    Ideal_generic.__init__(self, field, gens, coerce)
  File "/usr/local/lib/sage-4.1.1-linux-Ubuntu_9.04-i686-Linux/local/lib/python2.6/site-packages/sage/rings/ideal.py", line 239, in __init__
    gens = [ring(x) for x in gens]
  File "parent.pyx", line 882, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:6462)
  File "coerce_maps.pyx", line 82, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3118)
  File "coerce_maps.pyx", line 77, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3021)
  File "/usr/local/lib/sage-4.1.1-linux-Ubuntu_9.04-i686-Linux/local/lib/python2.6/site-packages/sage/rings/number_field/number_field.py", line 1096, in _element_constructor_
    return self._coerce_from_other_number_field(x)
  File "/usr/local/lib/sage-4.1.1-linux-Ubuntu_9.04-i686-Linux/local/lib/python2.6/site-packages/sage/rings/number_field/number_field.py", line 4837, in _coerce_from_other_number_field
    raise TypeError, "Cannot coerce element into this number field"
TypeError: Cannot coerce element into this number field
}}}

{{{id=18|
ZZ.ideal(11).residue_symbol(7,2)
///
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_11.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("WlouaWRlYWwoMTEpLnJlc2lkdWVfc3ltYm9sKDcsMik="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single')
  File "", line 1, in <module>
    
  File "/tmp/tmppqWkS7/___code___.py", line 3, in <module>
    exec compile(u'ZZ.ideal(_sage_const_11 ).residue_symbol(_sage_const_7 ,_sage_const_2 )' + '\n', '', 'single')
  File "", line 1, in <module>
    
  File "element.pyx", line 306, in sage.structure.element.Element.__getattr__ (sage/structure/element.c:2666)
  File "parent.pyx", line 272, in sage.structure.parent.getattr_from_other_class (sage/structure/parent.c:2840)
  File "parent.pyx", line 172, in sage.structure.parent.raise_attribute_error (sage/structure/parent.c:2638)
AttributeError: 'Ideal_pid' object has no attribute 'residue_symbol'
}}}

{{{id=38|
7.residue_symbol(ZZ.ideal(11),2)
///
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_12.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Ny5yZXNpZHVlX3N5bWJvbChaWi5pZGVhbCgxMSksMik="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single')
  File "", line 1, in <module>
    
  File "/tmp/tmpjLOroM/___code___.py", line 3, in <module>
    exec compile(u'_sage_const_7 .residue_symbol(ZZ.ideal(_sage_const_11 ),_sage_const_2 )' + '\n', '', 'single')
  File "", line 1, in <module>
    
  File "element.pyx", line 306, in sage.structure.element.Element.__getattr__ (sage/structure/element.c:2666)
  File "parent.pyx", line 272, in sage.structure.parent.getattr_from_other_class (sage/structure/parent.c:2840)
  File "parent.pyx", line 170, in sage.structure.parent.raise_attribute_error (sage/structure/parent.c:2611)
AttributeError: 'sage.rings.integer.Integer' object has no attribute 'residue_symbol'
}}}

{{{id=2|
P = K.ideal(5)
P.residue_symbol(w,3)
///
w - 1
}}}

{{{id=26|
P.residue_symbol?
///
<html><!--notruncate-->
<div class="docstring">
    
  <p><strong>File:</strong> /usr/local/lib/sage-4.1.1-linux-Ubuntu_9.04-i686-Linux/local/lib/python2.6/site-packages/sage/rings/number_field/number_field_ideal.py</p>
<p><strong>Type:</strong> &lt;type &#8216;instancemethod&#8217;&gt;</p>
<p><strong>Definition:</strong> P.residue_symbol(e, m, check=True)</p>
<p><strong>Docstring:</strong></p>
<blockquote>
<p>The m-th power residue symbol for an element e and the proper ideal.</p>
<div class="math">
\left(\frac{\alpha}{\mathbf{P}}\right) \equiv \alpha^{\frac{N(\mathbf{P})-1}{m}} \operatorname{mod} \mathbf{P}</div>
<div class="math"></div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">accepts m=1, in which case returns 1</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">can also be called for an element from sage.rings.number_field_element.residue_symbol</p>
</div>
<p>INPUT:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">e</span></tt> - element of the number field</li>
<li><tt class="docutils literal"><span class="pre">m</span></tt> - positive integer</li>
</ul>
<p>OUTPUT:</p>
<ul class="simple">
<li>an m-th root of unity in the number field</li>
</ul>
<p>EXAMPLES:</p>
<div class="highlight-python"><pre class="literal-block">Quadratic Residue (7 is not a square modulo 11)
sage: K.&lt;a&gt; = NumberField(x-1)
sage: K.ideal(11).residue_symbol(7,2)
-1

Cubic Residue
sage: K.&lt;w&gt; = NumberField(x^2 - x + 1)
sage: K.ideal(17).residue_symbol(w^2+3,3)
-w</pre>
</div>
</blockquote>


</div>
</html>
}}}

{{{id=27|
w.residue_symbol?
///
<html><!--notruncate-->
<div class="docstring">
    
  <p><strong>File:</strong> /usr/local/lib/sage-4.1.1-linux-Ubuntu_9.04-i686-Linux/devel/sage/sage/rings/number_field/number_field_element.pyx</p>
<p><strong>Type:</strong> &lt;type &#8216;builtin_function_or_method&#8217;&gt;</p>
<p><strong>Definition:</strong> w.residue_symbol(P, m, check=True)</p>
<p><strong>Docstring:</strong></p>
<blockquote>
<p>The m-th power residue symbol for an element self and proper ideal P.</p>
<div class="math">
\left(\frac{\alpha}{\mathbf{P}}\right) \equiv \alpha^{\frac{N(\mathbf{P})-1}{m}} \operatorname{mod} \mathbf{P}</div>
<div class="math"></div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">accepts m=1, in which case returns 1</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">can also be called for an ideal from sage.rings.number_field_ideal.residue_symbol</p>
</div>
<p>INPUT:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">P</span></tt> - proper ideal of the number field (or an extension)</li>
<li><tt class="docutils literal"><span class="pre">m</span></tt> - positive integer</li>
</ul>
<p>OUTPUT:</p>
<ul class="simple">
<li>an m-th root of unity in the number field</li>
</ul>
<p>EXAMPLES:</p>
<div class="highlight-python"><pre class="literal-block">Quadratic Residue (7 is not a square modulo 11)
sage: K.&lt;a&gt; = NumberField(x-1)
sage: K(7).residue_symbol(K.ideal(11),2)
-1

Cubic Residue
sage: K.&lt;w&gt; = NumberField(x^2 - x + 1)
sage: (w^2+3).residue_symbol(K.ideal(17),3)
-w</pre>
</div>
</blockquote>


</div>
</html>
}}}

{{{id=28|
m = 4
K.<a> = QQ[I]
p = K.ideal(3)
G.<w> = p.residue_field()
z = G.zeta()
alpha = [ G.lift(z^i) for i in range(G.zeta_order()) ]
chi_alpha = [ p.residue_symbol(e, m, check=False) for e in alpha ]
///
}}}

{{{id=31|
alpha
///
[1, 2*I + 2, 2*I, I + 2, 2, I + 1, I, 2*I + 1]
}}}

{{{id=30|
chi_alpha
///
[1, -I, -1, I, 1, -I, -1, I]
}}}

{{{id=22|
K.<a> = NumberField(x-1)
P = K.ideal(11)
P.residue_symbol(7,2)
///
-1
}}}

{{{id=24|
K.<a> = NumberField(x-1)
K(7).residue_symbol(K.ideal(11),2)
///
-1
}}}

{{{id=43|
K.<w> = NumberField(x^2 - x + 1)
(w^2+3).residue_symbol(K.ideal(17),3)
///
-w
}}}

{{{id=44|
H.<s> = NumberField(x^2 + 3)
///
}}}

{{{id=49|
R.<t> = NumberField(cyclotomic_polynomial(7))
///
}}}

{{{id=50|
S1=[R((t^4+t+3)^i).residue_symbol(R.primes_above(13)[0],7) for i in range(0,7)]; S1
///
[1, t, t^2, t^3, t^4, t^5, -t^5 - t^4 - t^3 - t^2 - t - 1]
}}}

{{{id=45|
P = R.primes_above(13)[0]
///
}}}

{{{id=48|
k = R.residue_field(P)
///
}}}

{{{id=59|
(P.norm()-1)/7
///
24
}}}

{{{id=51|
S2=[k((t^4+t+3)^i)^24 for i in range(0,7)]; S2
///
[1, tbar, 10*tbar + 12, 8*tbar + 3, 5*tbar + 5, 3*tbar + 8, 12*tbar + 10]
}}}

{{{id=52|
[k(S1[i])-k(S2[i]) for i in range(0,7)]
///
[0, 0, 0, 0, 0, 0, 0]
}}}

{{{id=60|

///
}}}