Ticket #12766: 12766_2.patch

File 12766_2.patch, 3.2 KB (added by roed, 9 years ago)
  • sage/schemes/elliptic_curves/ell_generic.py

    # HG changeset patch
    # User David Roe <roed.math@gmail.com>
    # Date 1333040918 -3600
    # Node ID bcf3992cc582036a4668e3541bb6e59b1db7a4d3
    # Parent  eb7da208bbd5632b495e7951700febf3fc054554
    12766: Fixes to docstrings, a fix to allow a pair for xmin.
    
    diff --git a/sage/schemes/elliptic_curves/ell_generic.py b/sage/schemes/elliptic_curves/ell_generic.py
    a b  
    25182518          - ``unbounded`` -- scale the plot to show the unbounded
    25192519            component, including the two flex points.
    25202520
    2521         -  ``**args`` - all other options are passed to the
    2522            line graphing primitive.
     2521        - ``plot_points`` -- passed to
     2522          :func:`sage.plot.generate_plot_points`
    25232523       
     2524        - ``adaptive_tolerance`` -- passed to
     2525          :func:`sage.plot.generate_plot_points`
     2526
     2527        - ``adaptive_recursion`` -- passed to
     2528          :func:`sage.plot.generate_plot_points`
     2529
     2530        - ``randomize`` -- passed to
     2531          :func:`sage.plot.generate_plot_points`
     2532
     2533        -  ``**args`` - all other options are passed to
     2534           :class:`sage.plot.line.Line`
    25242535       
    25252536        EXAMPLES::
    25262537       
     
    25282539            sage: plot(E, rgbcolor=hue(0.7))
    25292540            sage: E = EllipticCurve('37a')
    25302541            sage: plot(E)
    2531             sage: plot(E, xmin=25,xmax=25)
     2542            sage: plot(E, xmin=25,xmax=26)
     2543
     2544        With #12766 we added the components keyword::
     2545
     2546            sage: E.real_components()
     2547            2
     2548            sage: E.plot(components='bounded')
     2549            sage: E.plot(components='unbounded')
     2550
     2551        If there is only one component then specifying
     2552        components='bounded' raises a ValueError::
     2553
     2554            sage: E = EllipticCurve('9990be2')
     2555            sage: E.plot(components='bounded')
     2556            Traceback (most recent call last):
     2557            ...
     2558            ValueError: no bounded component for this curve
    25322559        """
    25332560        RR = rings.RealField()
    25342561        K = self.base_ring()
     
    25492576        r.sort()
    25502577        if components == 'bounded' and len(r) == 1:
    25512578            raise ValueError("no bounded component for this curve")
     2579        if isinstance(xmin, (tuple, list)):
     2580            if xmax is not None:
     2581                raise ValueError("xmax must be None if xmin is a tuple")
     2582            if len(xmin) != 2:
     2583                raise ValueError("if xmin is a tuple it must have length 2")
     2584            xmin, xmax = xmin
    25522585        if xmin is None or xmax is None:
    25532586            xmins = []
    25542587            xmaxs = []
    25552588            if components in ['both','bounded'] and len(r) > 1:
    25562589                xmins.append(r[0])
    25572590                xmaxs.append(r[1])
    2558             # The following 3 is an aesthetic choice.
     2591
     2592            # The following 3 is an aesthetic choice.  It's possible
     2593            # that we should compute both of the following when
     2594            # components=='both' and len(r) > 1 and take the maximum
     2595            # generated xmax.
    25592596            if components == 'unbounded' or components == 'both' and (len(r) == 1 or r[2] - r[1] > 3*(r[1] - r[0])):
    25602597                flex = self.division_polynomial(3).roots(RR, multiplicities=False)
    25612598                flex.sort()