本文整理汇总了Python中sage.rings.all.ComplexField.pi方法的典型用法代码示例。如果您正苦于以下问题:Python ComplexField.pi方法的具体用法?Python ComplexField.pi怎么用?Python ComplexField.pi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.rings.all.ComplexField
的用法示例。
在下文中一共展示了ComplexField.pi方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: map_to_complex_numbers
# 需要导入模块: from sage.rings.all import ComplexField [as 别名]
# 或者: from sage.rings.all.ComplexField import pi [as 别名]
def map_to_complex_numbers(self, z, prec=None):
"""
Evaluate ``self`` at a point `z \in X_0(N)` where `z` is given by
a representative in the upper half plane, returning a point in
the complex numbers.
All computations are done with ``prec`` bits
of precision. If ``prec`` is not given, use the precision of `z`.
Use self(z) to compute the image of z on the Weierstrass equation
of the curve.
EXAMPLES::
sage: E = EllipticCurve('37a'); phi = E.modular_parametrization()
sage: tau = (sqrt(7)*I - 17)/74
sage: z = phi.map_to_complex_numbers(tau); z
0.929592715285395 - 1.22569469099340*I
sage: E.elliptic_exponential(z)
(...e-16 - ...e-16*I : ...e-16 + ...e-16*I : 1.00000000000000)
sage: phi(tau)
(...e-16 - ...e-16*I : ...e-16 + ...e-16*I : 1.00000000000000)
"""
if prec is None:
try:
prec = z.parent().prec()
except AttributeError:
prec = 53
CC = ComplexField(prec)
if z in QQ:
raise NotImplementedError
z = CC(z)
if z.imag() <= 0:
raise ValueError("Point must be in the upper half plane")
# TODO: for very small imaginary part, maybe try to transform under
# \Gamma_0(N) to a better representative?
q = (2 * CC.gen() * CC.pi() * z).exp()
# nterms'th term is less than 2**-(prec+10) (c.f. eclib code)
nterms = (-(prec + 10) / q.abs().log2()).ceil()
# Use Horner's rule to sum the integral of the form
enumerated_an = list(enumerate(self._E.anlist(nterms)))[1:]
lattice_point = 0
for n, an in reversed(enumerated_an):
lattice_point += an / n
lattice_point *= q
return lattice_point