Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 92d28b3

Browse files
committed
Add - before th
1 parent 7b1b937 commit 92d28b3

File tree

2 files changed

+83
-83
lines changed

2 files changed

+83
-83
lines changed

src/sage/schemes/elliptic_curves/isogeny_class.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def __iter__(self):
9797

9898
def __getitem__(self, i):
9999
"""
100-
Return the `i` th curve in the class.
100+
Return the `i`-th curve in the class.
101101
102102
EXAMPLES::
103103

src/sage/schemes/riemann_surfaces/riemann_surface.py

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,9 @@ class RiemannSurface():
350350
by the monomials of degree up to `d-3`.
351351
352352
- ``integration_method`` -- (default: ``'rigorous'``). String specifying the
353-
integration method to use when calculating the integrals of differentials.
353+
integration method to use when calculating the integrals of differentials.
354354
The options are ``'heuristic'`` and ``'rigorous'``, the latter of
355-
which is often the most efficient.
355+
which is often the most efficient.
356356
357357
EXAMPLES::
358358
@@ -386,19 +386,19 @@ class RiemannSurface():
386386
sage: all( len(T.minpoly().roots(K)) > 0 for T in A)
387387
True
388388
389-
The ``'heuristic'`` integration method uses the method ``integrate_vector``
390-
defined in ``sage.numerical.gauss_legendre`` to compute integrals of differentials.
391-
As mentioned there, this works by iteratively doubling the number of nodes
389+
The ``'heuristic'`` integration method uses the method ``integrate_vector``
390+
defined in ``sage.numerical.gauss_legendre`` to compute integrals of differentials.
391+
As mentioned there, this works by iteratively doubling the number of nodes
392392
used in the quadrature, and uses a heuristic based on the rate at which the
393393
result is seemingly converging to estimate the error. The ``'rigorous'``
394-
method uses results from [Neu2018]_, and bounds the algebraic integrands on
394+
method uses results from [Neu2018]_, and bounds the algebraic integrands on
395395
circular domains using Cauchy's form of the remainder in Taylor approximation
396396
coupled to Fujiwara's bound on polynomial roots (see Bruin-DisneyHogg-Gao,
397-
in preparation). Note this method of bounding on circular domains is also
398-
implemented in :meth:`_compute_delta`. The net result of this bounding is
397+
in preparation). Note this method of bounding on circular domains is also
398+
implemented in :meth:`_compute_delta`. The net result of this bounding is
399399
that one can know (an upper bound on) the number of nodes required to achieve
400-
a certain error. This means that for any given integral, assuming that the
401-
same number of nodes is required by both methods in order to achieve the
400+
a certain error. This means that for any given integral, assuming that the
401+
same number of nodes is required by both methods in order to achieve the
402402
desired error (not necessarily true in practice), approximately half
403403
the number of integrand evaluations are required. When the required number
404404
of nodes is high, e.g. when the precision required is high, this can make
@@ -408,7 +408,7 @@ class RiemannSurface():
408408
if the computation is 'fast', the heuristic method may outperform the
409409
rigorous method, but for slower computations the rigorous method can be much
410410
faster::
411-
411+
412412
sage: f = z*w^3+z^3+w
413413
sage: p = 53
414414
sage: Sh = RiemannSurface(f, prec=p, integration_method='heuristic')
@@ -417,18 +417,18 @@ class RiemannSurface():
417417
sage: import time
418418
sage: nodes.cache.clear()
419419
sage: ct = time.time()
420-
sage: Rh = Sh.riemann_matrix()
420+
sage: Rh = Sh.riemann_matrix()
421421
sage: ct1 = time.time()-ct
422422
sage: nodes.cache.clear()
423423
sage: ct = time.time()
424-
sage: Rr = Sr.riemann_matrix()
424+
sage: Rr = Sr.riemann_matrix()
425425
sage: ct2 = time.time()-ct
426426
sage: ct2/ct1 # random
427427
1.2429363969691192
428428
429429
This disparity in timings can get increasingly worse, and testing has shown
430430
that even for random quadrics the heuristic method can be as bad as 30 times
431-
slower.
431+
slower.
432432
433433
TESTS:
434434
@@ -1549,27 +1549,27 @@ def _bounding_data(self, differentials):
15491549
INPUT:
15501550
15511551
- ``differentials`` -- list. A list of polynomials in ``self._R`` giving
1552-
the numerators of the differentials, as per the output of
1553-
:meth:`cohomology_basis`.
1552+
the numerators of the differentials, as per the output of
1553+
:meth:`cohomology_basis`.
15541554
15551555
OUTPUT:
15561556
1557-
A tuple ``(CCzg, [(g, dgdz, F, a0_info), ...])`` where each element of
1557+
A tuple ``(CCzg, [(g, dgdz, F, a0_info), ...])`` where each element of
15581558
the list corresponds to an element of ``differentials``. Introducing the
1559-
notation ``RBzg = PolynomialRing(self._R, ['z','g'])`` and
1559+
notation ``RBzg = PolynomialRing(self._R, ['z','g'])`` and
15601560
``CCzg = PolynomialRing(self._CC, ['z','g'])``, we have that:
15611561
1562-
- ``g`` is the full rational function in ``self._R.fraction_field()``
1562+
- ``g`` is the full rational function in ``self._R.fraction_field()``
15631563
giving the differential,
15641564
- ``dgdz`` is the derivative of ``g`` with respect to ``self._R.gen(0)``
1565-
, written in terms of ``self._R.gen(0)`` and ``g``, hence laying in
1565+
, written in terms of ``self._R.gen(0)`` and ``g``, hence laying in
15661566
``RBzg``,
1567-
- ``F`` is the minimal polynomial of ``g`` over ``self._R.gen(0)``,
1567+
- ``F`` is the minimal polynomial of ``g`` over ``self._R.gen(0)``,
15681568
laying in the polynomial ring ``CCzg``,
1569-
- ``a0_info`` is a tuple ``(lc, roots)`` where ``lc`` and ``roots`` are
1569+
- ``a0_info`` is a tuple ``(lc, roots)`` where ``lc`` and ``roots`` are
15701570
the leading coefficient and roots of the polynomial in ``CCzg.gen(0)``
1571-
that is the coefficient of the term of ``F`` of highest degree in
1572-
``CCzg.gen(1)``.
1571+
that is the coefficient of the term of ``F`` of highest degree in
1572+
``CCzg.gen(1)``.
15731573
15741574
EXAMPLES::
15751575
@@ -1592,8 +1592,8 @@ def _bounding_data(self, differentials):
15921592
-0.500000000000000 + 0.866025403784439*I]))])
15931593
15941594
"""
1595-
# This copies previous work by NB, outputting the zipped list required
1596-
# for a certified line integral.
1595+
# This copies previous work by NB, outputting the zipped list required
1596+
# for a certified line integral.
15971597
RB = self._R.base_ring()
15981598
P = PolynomialRing(RB, 'Z')
15991599
k = P.fraction_field()
@@ -1602,30 +1602,30 @@ def _bounding_data(self, differentials):
16021602
L = k.extension(fZW, 'Wb')
16031603
dfdw_L = self._dfdw(P.gen(0), L.gen(0))
16041604
integrand_list = [h/self._dfdw for h in differentials]
1605-
# minpoly_univ gives the minimal polynomial for h, in variable x, with
1605+
# minpoly_univ gives the minimal polynomial for h, in variable x, with
16061606
# coefficients given by polynomials in P (i.e. rational polynomials in Z).
16071607
minpoly_univ = [(h(P.gen(0), L.gen(0))/dfdw_L).minpoly().numerator()
16081608
for h in differentials]
16091609
RBzg = PolynomialRing(RB, ['z', 'g'])
1610-
# The following line changes the variables in these minimal polynomials
1610+
# The following line changes the variables in these minimal polynomials
16111611
# as Z -> z, x -> G, then evaluates at G = QQzg.gens(1) ( = g )
16121612
RBzgG = PolynomialRing(RBzg, 'G')
16131613
minpoly_list = [RBzgG([c(RBzg.gen(0)) for c in list(h)])(RBzg.gen(1))
16141614
for h in minpoly_univ]
16151615
# h(z,g)=0 --> dg/dz = - dhdz/dhdg
16161616
dgdz_list = [-h.derivative(RBzg.gen(0))/h.derivative(RBzg.gen(1))
16171617
for h in minpoly_list]
1618-
1618+
16191619
CCzg = PolynomialRing(self._CC, ['z','g'])
16201620
CCminpoly_list = [CCzg(h) for h in minpoly_list]
1621-
1621+
16221622
a0_list = [P(h.leading_coefficient()) for h in minpoly_univ]
16231623
# Note that because the field over which the Riemann surface is defined
1624-
# is embedded into CC, it has characteristic 0, and so we know the
1624+
# is embedded into CC, it has characteristic 0, and so we know the
16251625
# irreducible factors are all separable, i.e. the roots have multiplicity
1626-
# one.
1626+
# one.
16271627
a0_info = [(self._CC(a0.leading_coefficient()),
1628-
flatten([self._CCz(F).roots(multiplicities=False)*m
1628+
flatten([self._CCz(F).roots(multiplicities=False)*m
16291629
for F, m in a0.factor()]))
16301630
for a0 in a0_list]
16311631
return CCzg, list(zip(integrand_list, dgdz_list, CCminpoly_list, a0_info))
@@ -1635,10 +1635,10 @@ def rigorous_line_integral(self, upstairs_edge, differentials, bounding_data):
16351635
Perform vectorized integration along a straight path.
16361636
16371637
Using the error bounds for Gauss-Legendre integration found in [Neu2018]_
1638-
and a method for bounding an algebraic integrand on a circular domains
1639-
using Cauchy's form of the remainder in Taylor approximation coupled to
1640-
Fujiwara's bound on polynomial roots (see Bruin-DisneyHogg-Gao, in
1641-
preparation), this method calculates (semi-)rigorously the integral of a
1638+
and a method for bounding an algebraic integrand on a circular domains
1639+
using Cauchy's form of the remainder in Taylor approximation coupled to
1640+
Fujiwara's bound on polynomial roots (see Bruin-DisneyHogg-Gao, in
1641+
preparation), this method calculates (semi-)rigorously the integral of a
16421642
list of differentials along an edge of the upstairs graph.
16431643
16441644
INPUT:
@@ -1651,7 +1651,7 @@ def rigorous_line_integral(self, upstairs_edge, differentials, bounding_data):
16511651
the equation defining the Riemann surface.
16521652
16531653
- ``bounding_data`` -- tuple containing the data required for bounding
1654-
the integrands. This should be in the form of the output from
1654+
the integrands. This should be in the form of the output from
16551655
:meth:`_bounding_data`.
16561656
16571657
OUTPUT:
@@ -1677,81 +1677,81 @@ def rigorous_line_integral(self, upstairs_edge, differentials, bounding_data):
16771677
16781678
.. NOTE::
16791679
1680-
Uses data that ``homology_basis`` initializes.
1680+
Uses data that ``homology_basis`` initializes.
16811681
16821682
Note also that the data of the differentials is contained within
1683-
``bounding_data``. It is, however, still advantageous to have this
1683+
``bounding_data``. It is, however, still advantageous to have this
16841684
be a separate argument, as it lets the user supply a fast-callable
1685-
version of the differentials, to significantly speed up execution
1686-
of the integrand calls, and not have to re-calculate these
1685+
version of the differentials, to significantly speed up execution
1686+
of the integrand calls, and not have to re-calculate these
16871687
fast-callables for every run of the function. This is also the benefit
1688-
of representing the differentials as a polynomial over a known
1689-
common denominator.
1688+
of representing the differentials as a polynomial over a known
1689+
common denominator.
16901690
16911691
.. TODO::
16921692
16931693
Note that bounding_data contains the information of the integrands,
16941694
so one may want to check for consistency between ``bounding_data``
1695-
and ``differentials``. If so one would not want to do so at the
1696-
expense of speed.
1695+
and ``differentials``. If so one would not want to do so at the
1696+
expense of speed.
16971697
1698-
Moreover, the current implementation bounds along a line by
1698+
Moreover, the current implementation bounds along a line by
16991699
splitting it up into segments, each of which can be covered entirely
1700-
by a single circle, and then placing inside that the ellipse
1700+
by a single circle, and then placing inside that the ellipse
17011701
required to bound as per [Neu2018]_. This is reliably more efficient
1702-
than the heuristic method, especially in poorly-conditioned cases
1702+
than the heuristic method, especially in poorly-conditioned cases
17031703
where discriminant points are close together around the edges, but
17041704
in the case where the branch locus is well separated, it can require
17051705
slightly more nodes than necessary. One may want to include a method
1706-
here to transition in this regime to an algorithm that covers the
1707-
entire line with one ellipse, then bounds along that ellipse with
1708-
multiple circles.
1706+
here to transition in this regime to an algorithm that covers the
1707+
entire line with one ellipse, then bounds along that ellipse with
1708+
multiple circles.
17091709
"""
1710-
# Note that this, in its current formalism, makes no check that bounding
1711-
# data at all corresponds to the differentials given. The onus is then
1710+
# Note that this, in its current formalism, makes no check that bounding
1711+
# data at all corresponds to the differentials given. The onus is then
17121712
# on the design of other functions which use it.
1713-
1714-
# CCzg is required to be known as we need to know the ring which the minpolys lie in.
1713+
1714+
# CCzg is required to be known as we need to know the ring which the minpolys lie in.
17151715
CCzg, bounding_data_list = bounding_data
1716-
1716+
17171717
i0, _ = upstairs_edge[0]
17181718
i1, _ = upstairs_edge[1]
17191719
z0 = self._vertices[i0]
17201720
z1 = self._vertices[i1]
17211721
zwt, z1_minus_z0 = self.make_zw_interpolator(upstairs_edge)
1722-
1722+
17231723
# list of (centre, radius) pairs that still need to be processed
17241724
ball_stack = [(self._RR(1/2), self._RR(1/2), 0)]
1725-
alpha = self._RR(912/1000)
1726-
# alpha set manually for scaling purposes. Basic benchmarking shows
1727-
# that ~0.9 is a sensible value.
1725+
alpha = self._RR(912/1000)
1726+
# alpha set manually for scaling purposes. Basic benchmarking shows
1727+
# that ~0.9 is a sensible value.
17281728
E_global = self._RR(2)**(-self._prec+3)
17291729

1730-
# Output will iteratively store the output of the integral.
1730+
# Output will iteratively store the output of the integral.
17311731
V = VectorSpace(self._CC, len(differentials))
17321732
output = V(0)
17331733

1734-
# The purpose of this loop is as follows: We know we will be using
1734+
# The purpose of this loop is as follows: We know we will be using
17351735
# Gauss-Legendre quadrature to do the integral, and results from [Neu2018]_
1736-
# tell us an upper bound on the number of nodes required to achieve a
1737-
# given error bound for this quadrature, provided we have a bound for
1738-
# the integrand on a certain ellipse in the complex plane. The method
1736+
# tell us an upper bound on the number of nodes required to achieve a
1737+
# given error bound for this quadrature, provided we have a bound for
1738+
# the integrand on a certain ellipse in the complex plane. The method
17391739
# developed by Bruin and Gao that uses Cauchy and Fujiwara can bound an
17401740
# algebraic integrand on a circular region. Hence we need a way to change
1741-
# from bounding with an ellipse to bounding with a circle. The size of
1742-
# these circles will be constrained by the distance to the nearest point
1743-
# where the integrand blows up, i.e. the nearest branchpoint. Basic
1744-
# benchmarking showed that it was in general a faster method to split
1745-
# the original line segment into multiple smaller line segments, and
1741+
# from bounding with an ellipse to bounding with a circle. The size of
1742+
# these circles will be constrained by the distance to the nearest point
1743+
# where the integrand blows up, i.e. the nearest branchpoint. Basic
1744+
# benchmarking showed that it was in general a faster method to split
1745+
# the original line segment into multiple smaller line segments, and
17461746
# compute the contribution from each of the line segments bounding with
17471747
# a single circle, the benefits mainly coming when the curve is poorly
1748-
# conditioned s.t. the branch points are close together. The following
1749-
# loop does exactly this, repeatedly bisecting a segment if it is not
1748+
# conditioned s.t. the branch points are close together. The following
1749+
# loop does exactly this, repeatedly bisecting a segment if it is not
17501750
# possible to cover it entirely in a ball which encompasses an appropriate
1751-
# ellipse.
1751+
# ellipse.
17521752
def local_N(ct, rt):
17531753
cz = (1-ct)*z0+ct*z1 # This is the central z-value of our ball.
1754-
distances = [(cz-b).abs() for b in self.branch_locus]
1754+
distances = [(cz-b).abs() for b in self.branch_locus]
17551755
rho_z = min(distances)
17561756
rho_t = rho_z/(z1_minus_z0).abs()
17571757
rho_t = alpha*rho_t+(1-alpha)*rt # sqrt(rho_t*rt) could also work
@@ -1765,11 +1765,11 @@ def local_N(ct, rt):
17651765
n = minpoly.degree(CCzg.gen(1))
17661766
ai_new = [(minpoly.coefficient({CCzg.gen(1):i}))(z=cz+self._CCz.gen(0))
17671767
for i in range(n)]
1768-
ai_pos = [self._RRz([c.abs() for c in h.list()])
1768+
ai_pos = [self._RRz([c.abs() for c in h.list()])
17691769
for h in ai_new]
17701770
m = [a(rho_z)/z_1 for a in ai_pos]
17711771
l = len(m)
1772-
M_tilde = 2*max((m[i].abs())**(1/self._RR(l-i))
1772+
M_tilde = 2*max((m[i].abs())**(1/self._RR(l-i))
17731773
for i in range(l))
17741774
cg = g(cz,cw)
17751775
cdgdz = dgdz(cz,cg)
@@ -1786,15 +1786,15 @@ def local_N(ct, rt):
17861786

17871787
if not lN:
17881788
cz = (1-ct)*z0+ct*z1
1789-
distances = [(cz-b).abs() for b in self.branch_locus]
1789+
distances = [(cz-b).abs() for b in self.branch_locus]
17901790
rho_z = min(distances)
17911791
rho_t = rho_z/(z1_minus_z0).abs()
17921792

17931793
if rho_t <= rt:
17941794
ball_stack.append((ncts[0], nrt, 0))
17951795
ball_stack.append((ncts[1], nrt, 0))
17961796
continue
1797-
1797+
17981798
lN = local_N(ct, rt)
17991799

18001800
nNs = [local_N(nct, nrt) for nct in ncts]
@@ -1834,7 +1834,7 @@ def matrix_of_integral_values(self, differentials, integration_method="heuristic
18341834
- ``differentials`` -- a list of polynomials.
18351835
18361836
- ``integration_method`` -- (default: ``'heuristic'``). String specifying
1837-
the integration method to use. The options are ``'heuristic'`` and
1837+
the integration method to use. The options are ``'heuristic'`` and
18381838
``'rigorous'``.
18391839
18401840
OUTPUT:
@@ -1885,7 +1885,7 @@ def normalize_pairs(L):
18851885
raise ValueError("Invalid integration method")
18861886

18871887
integral_dict = {edge: line_int(edge) for edge in occurring_edges}
1888-
1888+
18891889
rows = []
18901890
for cycle in cycles:
18911891
V = VectorSpace(self._CC, len(differentials)).zero()
@@ -1928,7 +1928,7 @@ def period_matrix(self):
19281928
3
19291929
19301930
One can check that the two methods give similar answers::
1931-
1931+
19321932
sage: from sage.schemes.riemann_surfaces.riemann_surface import RiemannSurface
19331933
sage: R.<x,y> = QQ[]
19341934
sage: f = y^2 - x^3 + 1

0 commit comments

Comments
 (0)