ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 04 Nov 2018 08:45:21 -0600Reduce non-integral element mod idealhttp://ask.sagemath.org/question/44180/reduce-non-integral-element-mod-ideal/Suppose I have a nonzero ideal $I$ in a number field $K$, and an element $x \in K$ whose denominator ideal $\\{ \alpha \in O_K: \alpha x \in O_K\\}$ is coprime to $I$. Then x defines an element of $O_K / I$, even if $x \notin O_K$.
> How can I *efficiently* find an
> element $x' \in O_K$ which represents
> the same class in $O_K / I$ as $x$?
The first things I tried were `x % I`, `I.reduce(x)` and `I.small_residue(x)`, but these all either fail or return non-useful output if x isn't integral:
<pre>
sage: K.<a> = QuadraticField(10).objgen()
sage: I = K.ideal(3, a + 1)
sage: x = (1 - 2*a)/3
sage: x % I
[...]
TypeError: unsupported operand parent(s) for %
sage: I.reduce(x)
[...]
TypeError: reduce only defined for integral elements
sage: I.small_residue(x)
1/3*a + 4/3
</pre>
The only one-liner I could come up with was
<pre>
sage: I.reduce( x * x.denominator_ideal().element_1_mod(I) )
-a
</pre>
which works, but is a bit clumsy. Is there a simpler, cleaner Sage idiom for this?David LoefflerSun, 04 Nov 2018 08:45:21 -0600http://ask.sagemath.org/question/44180/Possible bug with identity morphismhttp://ask.sagemath.org/question/42625/possible-bug-with-identity-morphism/I have a number field `U` for which I consider its automorphisms through `Hom(U,U)`.
The identity `one=Hom(U,U).identity()` behaves weirdly under right multiplication:
U = CyclotomicField(3)
f = Hom(U,U)[1]
print f
print "--------------------"
one = Hom(U,U).identity()
print f*one
print "--------------------"
print one*f
print "--------------------"
print f*f
When I run this code, I expect `f` to be printed thrice, followed by the identity morphism.
However, while the first and third output do in fact both print `f`, the second prints
Composite map:
From: Cyclotomic Field of order 3 and degree 2
To: Cyclotomic Field of order 3 and degree 2
Defn: Identity endomorphism of Cyclotomic Field of order 3 and degree 2
then
Ring endomorphism of Cyclotomic Field of order 3 and degree 2
Defn: zeta3 |--> -zeta3 - 1
Is this a bug or is this this behaviour explained somewhere in the documentation?
MadPidgeonSun, 17 Jun 2018 05:47:03 -0500http://ask.sagemath.org/question/42625/Number field basis containing 1http://ask.sagemath.org/question/42150/number-field-basis-containing-1/ In Sage, the default basis for a maximal order $O_K$ often does not contain the element $1$:
sage: QuadraticField(-3).ring_of_integers().basis()
[1/2*a + 1/2, a]
However, $1$ is always a primitive lattice vector in $O_K$. Is there an elegant way to produce a basis containing $1$?eodorneyTue, 24 Apr 2018 14:21:01 -0500http://ask.sagemath.org/question/42150/Computation of homomorphisms of number fieldshttp://ask.sagemath.org/question/40798/computation-of-homomorphisms-of-number-fields/Given two number fields, I want to construct a morphism between them.
For this I tried to use the hom member-function of the NumberField object as follows:
R.<zeta3> = CyclotomicField(3)
P.<X> = PolynomialRing(R)
K.<gen1> = R.extension(X^3-zeta3)
L.<gen2> = R.extension(X^3-zeta3^2)
print K.gens(), L.gens()
H = K.hom( [gen2,zeta3^2], L )
print H
The help page of hom specifies:
> Return the unique homomorphism from self to codomain that
sends ``self.gens()`` to the entries of ``im_gens``.
Raises a TypeError if there is no such homomorphism.
However, instead of TypeError, I get an incomprehensible error:
> File "/home/sage/bin/sage2/local/lib/python2.7/site-packages/sage/rings/number_field/number_field.py", line 1670, in _element_constructor_
raise ValueError("Length must be equal to the degree of this number field")
ValueError: Length must be equal to the degree of this number field
What am I doing wrong? Is there a better way to define this morphism?MadPidgeonSat, 27 Jan 2018 05:24:56 -0600http://ask.sagemath.org/question/40798/Calculation of maximal order fails even when using "maximize_at_primes"http://ask.sagemath.org/question/40677/calculation-of-maximal-order-fails-even-when-using-maximize_at_primes/I would like to calculate the maximal order of a field for which I already know at which primes we should maximize.
This means that the discriminant does not have to be factored, which is normally the bottleneck of this algorithm.
I did
d = [2,3,5,7,11,13,17,19]
K.<y> = NumberField([x^2 - di for di in d], maximize_at_primes=[2])
RR = K.maximal_order()
The last command did not finish overnight, but gave the following warning:
"*** Warning: MPQS: number too big to be factored with MPQS,
giving up."
Which seems to indicate that the program is indeed trying to perform a large factorization despite the command "maximize_at_primes=[2]"
Meanwhile, Magma has no problem performing this computation in a few hours:
R<x> := PolynomialRing(Integers());
K := NumberField([x^2 - 2,x^2 - 3 , x^2-5,x^2-7,x^2 - 11,x^2 - 13 , x^2 - 17 , x^2 - 19]:Abs);
O := MaximalOrder(K: Ramification := [2]);
Am I doing something wrong ?
JF BiassebiasseThu, 18 Jan 2018 08:58:26 -0600http://ask.sagemath.org/question/40677/Eigenvalues of hecke operatorshttp://ask.sagemath.org/question/40588/eigenvalues-of-hecke-operators/For a project I am trying to build a program that computes a basis for cusp forms of weight 2 over $\Gamma_0(N)$. At one point, I want to represent eigenvalues of multiple Hecke operators. For example, (for $N=23$) I have found the following matrices for the Hecke operators:
$
T_2=\begin{pmatrix} -2 & -1/2 ;
2 & 1 \end{pmatrix}, T_3=\begin{pmatrix} 3 & 1 ;
-4 & -3 \end{pmatrix} \quad T_5=\begin{pmatrix} -2 & -1/2 ;
2 & 1 \end{pmatrix} \quad
$
so we have the following characteristic polynomials $f_2=x^2+x-1$, $f_3=x^2-5$, $f_5=x^2 +2x-4$. Suppose we denote the solution of $f_2$ (eigenvalues of $T_2$) by $a$ and it's conjugate. Then we can denote the solution of $f_3$ by $2a+1$ and of $f_5$ by $2a$.
I am trying to figure out how I can 'make' Sage represent these eigenvalues in this way. Say I have found these matrices above, I can create k.< a >=NumberField(x^2+x-1), then $a$ represents the root of the polynomial. So the question for me is, how can I make Sage give me the eigenvalues of $T_3$ and $T_5$ in terms of $a$?
Furthermore, I am wondering how to get the jordan normal form of $T_2$, or eigenmatrix in terms of $a$. If I ask for jordan_form, I get an error, and if I ask for eigenmatrix_right, I only get a numerical expression.
Remark: A little context, the goal for this project is to represent newforms in a similar way as Sage does, when you ask for example Newforms(23,2,names='a'). We need the eigenvalues of the hecke operators since they correspond with the coefficients of the Fourier series.
----------TheBeiramSat, 13 Jan 2018 04:32:29 -0600http://ask.sagemath.org/question/40588/factorization on number fieldshttp://ask.sagemath.org/question/40124/factorization-on-number-fields/ I am trying to factor a division polynomial on a number field and I get the following error.
"PariError: inconsistent concatenation t_COL (16 elts) , t_VEC (8 elts)"
Could you please tell me how I can rectify it?
Thank you very much in advance!
Here is the code I am trying to compile:
K.<rho> = NumberField(x^16 - 7*x^12 + 48*x^8 - 7*x^4 + 1)
Kx.<x> = K[]
P = 2*x^24 - 220779/1250*x^22 + 10143441/15625*x^21 - 142856857143/25000000*x^20 + 131732868267/19531250*x^19 + 31020130846593/5000000000*x^18 + 13930920190065879/1562500000000*x^17 - 421500204770774287041/5000000000000000*x^16 - 31485474287738310861/976562500000000*x^15 + 2518173788725346513398533/6250000000000000000*x^14 - 582641643196535738602059/3125000000000000000*x^13 - 73639749524289565897523550321/125000000000000000000000*x^12 + 20820019744955833474743619767/48828125000000000000000*x^11 + 300689661910158431801904075908157/625000000000000000000000000*x^10 - 4454385478020717587635582204420833/7812500000000000000000000000*x^9 + 16361877508124295728413974125123451/400000000000000000000000000000*x^8 + 1573027301404166809168217933184311901/9765625000000000000000000000000*x^7 - 11987294796540068181333112421577867214431/125000000000000000000000000000000000*x^6 + 113700674422931989849194398791831231927941/1562500000000000000000000000000000000*x^5 - 168139864900386988616344904823569275391618007/2500000000000000000000000000000000000000*x^4 + 2632186130949079940307397635576696383706753/78125000000000000000000000000000000000*x^3 - 116064304293562967834364362386796558774110963539/12500000000000000000000000000000000000000000*x^2 + 206061630034967578571315740889755584982886782011/156250000000000000000000000000000000000000000*x - 30099620598750107945851944211328293200688722593391/500000000000000000000000000000000000000000000000
print P.parent()==Kx
print P.roots()sushiTue, 12 Dec 2017 10:28:25 -0600http://ask.sagemath.org/question/40124/Substituting a complex embedding for a number field elementhttp://ask.sagemath.org/question/40006/substituting-a-complex-embedding-for-a-number-field-element/Is there a way to take an element of a number field (or a polynomial or a number field) and replace the generator of the field by one of its complex embeddings? For example, something like
sage: K.<a> = NumberField(x^2 - 3)
sage: (3*a + 5).substitute(a=a.complex_embeddings()[1])
It's feasible to do this with `sage_eval`, but hopefully there is a better way.jaebondThu, 07 Dec 2017 23:34:33 -0600http://ask.sagemath.org/question/40006/Monkey-patching PARI callshttp://ask.sagemath.org/question/39807/monkey-patching-pari-calls/I'm currently trying to implement some number field computations on a very particular number field (specifically, $K = \mathbb{Q}(\zeta_{n-1},n^{1/(n-1)})$). The code I've written so far has some bottlenecks that profiling via %prun has identified, namely:
1. `{method '_nf_rnfeq' of 'sage.libs.cypari2.gen.gen' objects}`, which seems to compute the minimal polynomial of $K$ (currently I'm defining $K$ via `F.<u> = CyclotomicField(n-1)`, and then `K.<a> = F.extension(x^(n-1) - n)`, so $K$ is a relative extension. `_nf_rnfeq` seems to compute the absolute minimal polynomial of a given relative extension (via PARI).
2. `{method 'discriminant' of 'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint' objects}`, which appears to just be the polynomial discriminant computation.
Assume I've done analysis by hand gives me a much faster computation of the absolute minimal polynomial for this particular number field. I'd then want a version of `_nf_rnfeq` that:
1. Checks if it's being called on my special case, where better algorithms exist. If so, run that.
2. Otherwise, run the traditional algorithm.
Of course, I'd prefer to make this modification without modifying the source code, as that seems to be an especially ugly solution.
One way to implement this is to change is by modifying the relevant method at run-time, via a technique known as "Monkey-Patching" (see [here](https://stackoverflow.com/questions/47503061/replacing-specific-function-calls/47503146#47503146)).
The issue I'm having now is that attempting to monkey-patch the PARI call gives me the error:
`TypeError: can't set attributes of built-in/extension type 'sage.libs.cypari2.gen.gen'`
The code I'm using (in the first cell of my IPython notebook) is below:
import sage.libs.cypari2.gen
orig_nf_rnfeq = sage.libs.cypari2.gen.gen._nf_rnfeq
def _nf_rnfeq(*args, **kwargs):
print("Rnfeq works!")
return orig_nf_rnfeq(*args, **kwargs)
sage.libs.cypari2.gen.gen._nf_rnfeq = _nf_rnfeqorangejakeSun, 26 Nov 2017 17:37:25 -0600http://ask.sagemath.org/question/39807/Polynomials over number fieldshttp://ask.sagemath.org/question/38381/polynomials-over-number-fields/Below I define a polynomial ring K[s,t]. My goal is to compute the minors of a large matrix with entries in this ring.
var('x')
# K.<t> = NumberField(x^2-2)
K.<s,t> = NumberField([x^2-2,x^2-5])
R.<p0,p1,p2,p3,p4,p5> = K[]
M = Mat(R,10,10).random_element()
mins = M.minors(2)
This code works fine, but if I replace the last line with
mins = M.minors(7)
it fails with the error message
TypeError: no conversion to a Singular ring defined
Is it possible to avoid this error?coreyharrisMon, 24 Jul 2017 11:09:25 -0500http://ask.sagemath.org/question/38381/How to compute a cyclic subgroup of a class group?http://ask.sagemath.org/question/38198/how-to-compute-a-cyclic-subgroup-of-a-class-group/ Hello, I am quite new to computing in Sage and I am stuck at this point. Please help me out. I am going to use algebraic number theory notation without explaining them in detail. All computations are in quadratic fields.
What I have :
- $\Delta_p=p^2\Delta_K$ where $p$ is a prime, $\Delta_K=-pq$ and $\Delta_K\equiv 1$ mod $4$
- I computed the class group, $C(\Delta_p)$ in Sage
What I want :
- Set $f=[(p^2,p)]$ in $C(\Delta_p)$ where $(p^2,p)$ is the standard representation of an ideal of norm $p^2$
- Set $F=\langle f \rangle$
My question is :
- How to get that cyclic subgroup $F$?
I have been looking at AbelianGroup and ClassGroup in Sage but I am not quite understanding how to use these to actually get what I want.
Any help in this matter would be greatly appreciated.jakkeonSat, 08 Jul 2017 12:52:42 -0500http://ask.sagemath.org/question/38198/Group of units of number field mod idealhttp://ask.sagemath.org/question/35499/group-of-units-of-number-field-mod-ideal/I am wondering whether Sage has a built-in function that takes an ideal $\mathfrak{a}$ of a number field and returns the unit group of the quotient ring $(\mathcal{O}_K / \mathfrak{a})^{\times}.$
More specifically the problem is to iterate through the characters of $(\mathcal{O}_K / \mathfrak{a})^{\times}$ (essentially Hecke characters) and apply them to a given element of $\mathcal{O}_K$. I am at a bit of a loss as to how to do this in Sage.user58293Thu, 10 Nov 2016 01:33:57 -0600http://ask.sagemath.org/question/35499/y-coordinate of a 4-torsion pointhttp://ask.sagemath.org/question/35410/y-coordinate-of-a-4-torsion-point/I want to find the `y`-coordinate of a 4-torsion point. I have the following code where I found the x-coordinate
E3=EllipticCurve([0,0,0,-3267,45630])
E=E3.division_polynomial(4);E
E.factor()
which gives
8*(x^4 + 30*x^3 - 18252*x^2 + 280530*x + 6465339)*(x^2 + 15*x - 3042)*(x^2 - 30*x + 2817)*(x - 15)
Then I factor $x^2 - 30x + 2817$ in $\mathbb{Q}(\sqrt{-2})$ and I got $[(-36\sqrt{-2} + 15, 1), (36\sqrt{-2} + 15, 1)]$ which is my x-coordinate. How to get the y-coordinate? If I denote $\sqrt{-2}=B$, then I have $x=15\pm 36B$. And I substitute it into my elliptic curve gives
B = var('B')
y2=x^3-3267*x+45630;y2
y=y2.subs({x:15+36*B});y
Y=y.simplify_full();Y
YY=Y.subs({B^2:-2});YY
YYY=YY.subs({B^3:-2*B});YYY
which equals to $y^2=186624B-116640$. How to get the y-coordinate. By trying an error multiple times (using PARI-gp) I manage to get y-coordinate as $y=27a^3-135a-108aB$ with $a^4-5a^2-32=0$ and $B^2=-2$. But i got this by trying an error comparing LHs and RHS equation. Not straight away from $y^2=186624B-116640$. I tried the following but it did not work :
K.<a> = NumberField(x^4 -5*x^2-32); K
f = K.factor(186624*B-116640); fShaThu, 03 Nov 2016 21:01:35 -0500http://ask.sagemath.org/question/35410/point addition on elliptic curvehttp://ask.sagemath.org/question/35343/point-addition-on-elliptic-curve/ I have the following code where I want to add a 4-torsion point given by
`P=[15+36*B, 27*a*(a^2-4*B-5)]` with `B^2=-2` and `a^4-5*a^2-32=0`
and `Q=[r,s]` on my elliptic curve `E` as given below:
E=EllipticCurve([-3267,45630])
k.<B>=NumberField(x^2-2)
k.<a>=NumberField(x^4-5*x^2-32)
kr.<r>=FunctionField(k);
krS.<S>=kr[]
R.<s>=krS.quo(S^2-(r^3-3267*r+45630))
P=E(R)(15+36*B, 27*a*(a^2-4*B-5))
Q=E(R)(r,s)
P+Q
but it keeps giving error such as :
TypeError: unsupported operand parent(s) for '-': 'Number Field in a with defining polynomial x^4 - 5*x^2 - 32' and 'Number Field in B with defining polynomial x^2 - 2'
Can someone please advise me what is wrong in my coding.
ShaWed, 02 Nov 2016 03:40:58 -0500http://ask.sagemath.org/question/35343/Converting a symbolic exression to an element of a number fieldhttp://ask.sagemath.org/question/35184/converting-a-symbolic-exression-to-an-element-of-a-number-field/At some point in a calculation in the symbolic ring I end up with some numbers which are complex rationals of the form (a/b + I*(c/d). At this point I would like to no longer treat them as symbolic expressions and rather work with them in a more well behaved field. Since all of the computation I will be doing will keep things as complex rationals it seems like the number field `QQ[I]` is my best option.
**My question is**: How can I convert a symbolic expression like `SR(2/3+4/5*I)` to an element of `QQ[I]`. In general, there is no coercion from the symbolic ring to a number field, but in this special case there is a pretty clear map I would like to use.
Edit: I suppose since the map from the symbolic ring to the number field depends on an assumed embedding of the number field in the complex numbers, this might not be doable in any clean way. For now the following helper function works
<pre>
def SRtoQQI(v, imGen): # imGen = the immaginary unit in a ring QQ[I]
rp = QQ(v.real_part()) # get real part of input
ip = QQ(v.imag_part()) # get immaginary part of input
return rp + ip*imGen # combine parts to get output
</pre>
I am still interested to know if there is a build in way, maybe making use of the embedding maps from `QQ[I]` to `SR`.rlg23Tue, 18 Oct 2016 22:35:58 -0500http://ask.sagemath.org/question/35184/number fields and irreducible polynomialshttp://ask.sagemath.org/question/35028/number-fields-and-irreducible-polynomials/Hello gentle people. Let's see an example.
f=x^2+4
g=x^4+16
F=NumberField(f,'a')
The extension field of `F` by `g` cannot obtained by `F.extension(g(s),'s')` although we input `s=var('s')` before.
Because `g` is reducible in `F`. ( g=(x^2-4I)(x^2+4I) )
Can I check irreducibility of a polynomial in a number field?
Is there any method which makes a number field by given polynomial?
Thanks in advance.SeminSun, 02 Oct 2016 00:26:00 -0500http://ask.sagemath.org/question/35028/points on elliptic curve number fieldhttp://ask.sagemath.org/question/29867/points-on-elliptic-curve-number-field/I have the following elliptic curve : y^2=x^3-3267x+45630 and generator P=[-21,324].
I want to find the general formula to add any point (r,s) to the point ((-15/2)+(27/2)*B,0) where B^2=17.
PARI seems to be pretty straightforward in giving answer. And i think the mistake I did in SAGE is that I should define r and s in number field which I'm not sure how to do it.
The Pari code is as follows :
gp > elladd(E,[r,s],[(-15/2)+(27/2)*B,0])= [(-8*r^3 + (108*B - 60)*r^2 + (1458*B^2 - 1620*B + 450)*r + (8*s^2 + (-19683*B^3 + 32805*B^2 - 18225*B + 3375)))/(8*r^2 + (-216*B + 120)*r + (1458*B^2 - 1620*B + 450)), (-8*s*r^3 + (4374*B^2 - 4860*B + 1350)*s*r + (8*s^3 + (-39366*B^3 + 65610*B^2 - 36450*B + 6750)*s))/(-8*r^3 + (324*B - 180)*r^2 + (-4374*B^2 + 4860*B - 1350)*r + (19683*B^3 - 32805*B^2 + 18225*B - 3375))]
ShaFri, 09 Oct 2015 05:12:51 -0500http://ask.sagemath.org/question/29867/Finding a $\gamma$ to define a number field like $E=\mathbb{Q}(\zeta_5)(X^5-\gamma)$http://ask.sagemath.org/question/33638/finding-a-gamma-to-define-a-number-field-like-emathbbqzeta_5x5-gamma/ By working with eliptic curves, I found that the extension E defined by:
E.<a> = NumberField(x^20 - 2*x^19 - 2*x^18 + 18*x^17 - 32*x^16 + 88*x^15 + 58*x^14 -
782*x^13 + 1538*x^12 + 1348*x^11 - 466*x^10 - 894*x^9 + 346*x^8 -
114*x^7 - 424*x^6 - 88*x^5 + 214*x^4 + 54*x^3 + 14*x^2 + 4*x + 1)
Is a cyclic Kummer extension of degree $5$ over $\mathbb{Q}(\zeta_5)$, thus by the clasification of Kummer extensions, there exists $\gamma \in \mathbb{Q}(\zeta_5)$ such that $E=\mathbb{Q}(\sqrt[5]{\gamma})$.
So, about all the polynomials $f$ that define $E$ how do I find $\gamma$ such that the polynomial $X^5-\gamma$ also defines $E$?belvedereThu, 02 Jun 2016 02:13:29 -0500http://ask.sagemath.org/question/33638/p-part of a class grouphttp://ask.sagemath.org/question/9849/p-part-of-a-class-group/Hi
I am trying to compute the p-part of a class groups of some number fields. I was hoping to just call G.sylow_subgroup(p), but this function is not implemented for Abelian groups. In addition, invariants doesn't seem to work, for example, if G= C6, then G.invariants() returns [6], which doesn't seem correct.
I would appreciate any advice on how to do this. For example, can I coerce an Abelian Group to just be a finite group?
Note: I asked this on IRC without an answer. I hope it is not bad form to ask it here.
Partial Solution: Elementary divisors and some factorization code gives me what I want. However, it would be nice to be able to coerce an abelian group into a group.lalitkumarjMon, 25 Feb 2013 05:09:12 -0600http://ask.sagemath.org/question/9849/.subfields() not working in Sage 6.2; any workaround?http://ask.sagemath.org/question/33311/subfields-not-working-in-sage-62-any-workaround/ Running Sage 6.2, the .subfields() command is not working when applied to an octic number field. Is there any workaround?
(I'm using institutional resources, but they're having trouble updating the Sage version. Hence this question.)
The screenshot is linked below. (Awkward formatting because of the karma system; sorry!)
math.umd.edu/~bloom/sagescreenshot.png
samuelbloomTue, 03 May 2016 15:20:09 -0500http://ask.sagemath.org/question/33311/Fundamental Discriminanthttp://ask.sagemath.org/question/32945/fundamental-discriminant/ How can I print a list of around 10000 fundamental discriminant of quadratic number field in sage?LernerFri, 01 Apr 2016 11:43:37 -0500http://ask.sagemath.org/question/32945/The lattice of number fieldshttp://ask.sagemath.org/question/28722/the-lattice-of-number-fields/Let $L$ be some number field, and $\sigma_1,...,\sigma_{(r+s)}$ its embeddings in the real\complex field. Given an element $a$ in a $L$, how can I produce the vector $(\sigma_1(a),...,\sigma_{(r+s)}(a))$ , or better yet, is there a function returning the lattice embedding of $\mathcal{O}_L$ inside $\mathbb{R}^r \times \mathbb{C}^s $? Similarly, after computing the units group is there some function that returns $(\log |\sigma_i(u) |)$ for a given unit $u$ or the corresponding unit lattice? OfirThu, 30 Jul 2015 00:38:53 -0500http://ask.sagemath.org/question/28722/Does QuadraticField use any special algorithms for computing the class group of quadratic imaginary number fields?http://ask.sagemath.org/question/26922/does-quadraticfield-use-any-special-algorithms-for-computing-the-class-group-of-quadratic-imaginary-number-fields/ I need to compute the class group of a quadratic imaginary number field that has a fairly large discriminant (over 96 bits.) I was wondering what, if any, algorithms the QuadraticField class uses for computing the class group.
Dan ShumowFri, 22 May 2015 15:23:45 -0500http://ask.sagemath.org/question/26922/Ideal moduli and residue symbolshttp://ask.sagemath.org/question/26042/ideal-moduli-and-residue-symbols/ Hi, everyone;
I'm fairly new to sage, but I feel like I have some heavy lifting to do. I'm attempting to do a couple of things:
1) I need to see if two complex numbers are equivalent mod an ideal, eg pi == 1 mod 2+2i. It might be a dumb question but my searching thus far has come up short
2) I need to compute residue symbols, and I'm using the Number Field residue symbol method, but I'm having trouble. I have the following:
C = ComplexField()
I = C.0
r = C.ideal(b).residue_symbol(D,4)
with a and b complex numbers. Help!jwiebeThu, 05 Mar 2015 19:37:25 -0600http://ask.sagemath.org/question/26042/Zeta function gone wild?http://ask.sagemath.org/question/8418/zeta-function-gone-wild/Playing with number fields we reached some weird numerical results. Investigating the problem boiled down to weird output of zeta functions at odd positive integers from 7 onward.
For example,
sage: K.<a> = NumberField(x^2-2)
sage: K.zeta_function()(7)
82.7603619399160
sage: K.zeta_function(prec=100)(7)
45333.379954778857657650185188
sage: K.zeta_function(prec=200)(7)
5.6555192254423051174292272646037247772094677139829119697339e8
These answers seem to be all erroneous. Close values behave fine:
sage: K.zeta_function()(7.0000001)
1.00787667933529
sage: K.zeta_function()(7.00000001)
1.00787667982152
sage: K.zeta_function()(7.000000001)
1.00787669344227
sage: K.zeta_function()(7.0000000001)
1.00787388932573
(the problem begins afterwards).
Another way to obtain this value is
sage: quadratic_L_function__exact(7,2)*zeta(7)
TypeError: n must be a critical value!
which doesn't work. It turns out that this does work:
sage: quadratic_L_function__numerical(7,2)*zeta(7).n()
1.00787667988590
but this does not help us for general number fields (only quadratic).
The same happens with Riemann zeta function, which is the Dedekind zeta function of $\mathbb{Q}$:
sage: K.<a> = NumberField(x)
sage: K.zeta_function()(7)
verbose -1 (371: dokchitser.py, __call__) Warning: Loss of 2 decimal digits due to cancellation
52.5237126027390 # Wrong!
sage: zeta(7).n() # Checking Riemann directly
1.00834927738192 # okie dokie
sage: K.zeta_function()(7.00001)
verbose -1 (371: dokchitser.py, __call__) Warning: Loss of 2 decimal digits due to cancellation
1.00834921704698 # correct
so we get a warning here, and the value at 7 is wrong, but at 7.00001 things are fine.
We are guessing that this relates to zeros/poles of Gamma in the functional equation for zeta. However, since `zeta(7)` and `quadratic_L_function__numerical` do work fine, perhaps there is a way to calculate other zeta functions there as well?
parzanThu, 27 Oct 2011 05:01:44 -0500http://ask.sagemath.org/question/8418/multiple algebraic extensionhttp://ask.sagemath.org/question/10877/multiple-algebraic-extension/I'm looking for a way to formulate a number field which can express corners of a given regular $n$-gon exactly, but which might be faster than `AA`. I need to be able to check signs of elements of that number field. Here is what I tried:
n = 17
z = QQbar.zeta(n)
ca = z.real()
sa = z.imag()
QQ[ca, sa]
However I get the error message
ValueError: defining polynomial (x^16 - 17/4*x^14 + 119/16*x^12 -
221/32*x^10 + 935/256*x^8 - 561/512*x^6 + 357/2048*x^4 - 51/4096*x^2 +
17/65536) must be irreducible
How can I avoid this?MvGThu, 02 Jan 2014 21:24:00 -0600http://ask.sagemath.org/question/10877/splitting of primeshttp://ask.sagemath.org/question/8349/splitting-of-primes/Given a quadratic field, say,
K.<a>=QuadraticField(2)
Is there a method to know if a given prime splits/ stay inert/ ramify in K?
(For number-theoretic background:
http://en.wikipedia.org/wiki/Splitting_of_prime_ideals_in_Galois_extensions
)
I tried to look it up but didn't find anything.
Thanks a lot!!!
Menny
MennyTue, 27 Sep 2011 09:17:08 -0500http://ask.sagemath.org/question/8349/Number Fields and the Normhttp://ask.sagemath.org/question/8343/number-fields-and-the-norm/Hello,
I am currently very confused about how to use [Number Fields in Sage].(http://www.sagemath.org/doc/reference/sage/rings/number_field/number_field.html).
Things are not working.
Specifically I would like the norm of $\mathbb{Z}[\zeta_5]$ which should be a homogeneous polynomial of degree 4.
I tried:
>K.<g> = NumberField(1+x+x^2+x^3+x^4)
>a,b,c,d=var('a b c d')
>(a+b\*g+c\*g^2+d\*g^3).norm()
However that did not work.
I also tried:
>K.<g>=CyclotomicField(5); K
>a,b,c,d=var('a b c d')
>(a+b\*g+c\*g^2+d\*g^3).norm()
Instead of returning the norm in the Cyclotomic ring, this simply gave me the norm over the complex numbers, that is multiplication by the complex conjugate. These two things are very different, and the norm of the complex number is not at all correct. (It should be degree 4 not degree 2)
Any help is greatly appreciated, thank youEric NaslundMon, 26 Sep 2011 07:21:30 -0500http://ask.sagemath.org/question/8343/Functionality for elliptic curves over number fieldshttp://ask.sagemath.org/question/9926/functionality-for-elliptic-curves-over-number-fields/Hi,
I am interested in computing the integral points and evaluating the L-function of an elliptic curve over number fields (of small degree over Q). Despite much searching, it's not clear to me what Sage is currently capable of doing in this regard. Any guidance would be greatly appreciated! Thanks!quadratic2407Tue, 19 Mar 2013 13:44:22 -0500http://ask.sagemath.org/question/9926/Working with multiplicative groupshttp://ask.sagemath.org/question/8876/working-with-multiplicative-groups/Hi,
I am just learning cryptography and the DLP problem.
How can I create a finite multiplicative Group over Zp?
Sage has many Group related classes but apparently I am not math-savvy enough
to chose one ;-)tbenderSun, 15 Apr 2012 09:22:11 -0500http://ask.sagemath.org/question/8876/