# Fix a number field embedding for a newform for $\Gamma_0(N)$

I am trying to do some numerics with newforms for $\Gamma_0(N)$. E.g

sage: g=CuspForms(group=Gamma0(2),weight=26).newforms(names='a')[0].q_expansion(prec=10).truncate()
sage: g(exp(-10.))


gives me (an approximation) of the chosen newform at $10i/2\pi\in \mathbb H$. The chosen newform has coefficients in $\mathbb Q$

If instead I choose another newform

sage: g=CuspForms(group=Gamma0(2),weight=26).newforms(names='a')[1].q_expansion(prec=10).truncate()here


which has coefficients in the number field with defining polynomial $x^2 - 767888x - 9686519804864$ the command

sage:g(exp(-10.))


gives me an error which I interpret as Sage not knowing where to compute or that I have not fixed an embedding of the number field.

How do I fix an embedding and compute g(exp(-10.))?

edit retag close merge delete

( 2022-03-27 09:24:13 +0200 )edit

Sort by ยป oldest newest most voted

Indeed, newforms are over a number field without specified embedding.

Possibly an option could be added to use an embedded number field.

Not sure how to achieve that, so here is a workaround.

Idea:

• choose an embedding
• define a new version of the coefficient field
• tweak the polynomial to have coefficients there

Define the newforms.

sage: C = CuspForms(group=Gamma0(2), weight=26)
sage: C
Cuspidal subspace of dimension 5 of Modular Forms space of dimension 7
for Congruence Subgroup Gamma0(2) of weight 26 over Rational Field
sage: N = C.newforms(names='a')
sage: N
[q - 4096*q^2 + 97956*q^3 + 16777216*q^4 + 341005350*q^5 + O(q^6),
q + 4096*q^2 + (-a1 + 4096)*q^3 + 16777216*q^4 + (324*a1 + 431184822)*q^5 + O(q^6)]


Name the polynomials obtained by truncating the two newforms to order 10.

sage: g = N[0].q_expansion(prec=10).truncate()
sage: h = N[1].q_expansion(prec=10).truncate()


Observe that one is defined over the rationals, the other one over a number field.

sage: g[:6]
341005350*q^5 + 16777216*q^4 + 97956*q^3 - 4096*q^2 + q
sage: parent(g)
Univariate Polynomial Ring in q over Rational Field

sage: h[:6]
(324*a1 + 431184822)*q^5 + 16777216*q^4 + (-a1 + 4096)*q^3 + 4096*q^2 + q
sage: parent(h)
Univariate Polynomial Ring in q over Number Field in a1
with defining polynomial x^2 + 371656*x - 2423951154416


Explore the parent of the coefficients of h:

sage: K = parent(h[0])
sage: K
Number Field in a1 with defining polynomial x^2 + 371656*x - 2423951154416


List its embeddings to RR:

sage: emb = K.embeddings(RR)
sage: emb
[
Ring morphism:
From: Number Field in a1 with defining polynomial x^2 + 371656*x - 2423951154416
To:   Real Field with 53 bits of precision
Defn: a1 |--> -1.75378310139800e6,
Ring morphism:
From: Number Field in a1 with defining polynomial x^2 + 371656*x - 2423951154416
To:   Real Field with 53 bits of precision
Defn: a1 |--> 1.38212710139800e6
]


Define an embedded version of the number field K, choosing one of the embeddings:

sage: phi = emb[1]
sage: Ke = NumberField(K.polynomial(), K.variable_name(), embedding=phi(K.gen()))
sage: Ke


Take the polynomial of interest to that embedded field:

sage: he = Ke['q']([Ke(c.list()) for c in h.list()])


Inspect the result:

sage: he[:6]
(324*a1 + 431184822)*q^5 + 16777216*q^4 + (-a1 + 4096)*q^3 + 4096*q^2 + q


Now the polynomial can be evaluated at reals:

sage: he(-10.)
-3.06119845368516e17
sage: he(exp(-10.))
0.0000537135354901745

more

That is exactly what I was hoping for. Great answer!

( 2022-03-27 12:28:25 +0200 )edit

If it solves the question, you can mark it as accepted by clicking the "accept" button next to it (the button with a check mark). This will mark the question as solved in the list of questions.

( 2022-03-27 12:30:28 +0200 )edit

Done!. Thanks again!

( 2022-03-27 13:15:24 +0200 )edit