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
Welcome to Ask Sage! Thank you for your question.