Ticket #727: trac_727_more_conic_files6.patch

File trac_727_more_conic_files6.patch, 10.6 KB (added by Marco Streng, 12 years ago)

apply on sage 4.4.4 after trac_727_more_conic_files1,2,3,4,5

  • doc/en/reference/plane_curves.rst

    # HG changeset patch
    # User Marco Streng <marco.streng@gmail.com>
    # Date 1279489122 -7200
    # Node ID 7fadb062f93110d6495bf815dc84d4724315635c
    # Parent  1139fd5c5a44a4b005a484385ade564bd8ea1364
    Trac 727: fix doctests, remove global field
    
    diff -r 1139fd5c5a44 -r 7fadb062f931 doc/en/reference/plane_curves.rst
    a b  
    1313
    1414   sage/schemes/plane_conics/constructor
    1515   sage/schemes/plane_conics/con_field
    16    sage/schemes/plane_conics/con_global_field
    1716   sage/schemes/plane_conics/con_number_field
    1817   sage/schemes/plane_conics/con_rational_field
    1918   sage/schemes/plane_conics/con_finite_field
  • deleted file sage/schemes/plane_conics/con_global_field.py

    diff -r 1139fd5c5a44 -r 7fadb062f931 sage/schemes/plane_conics/con_global_field.py
    + -  
    1 r"""
    2 Projective plane conics over a global field.
    3 
    4 AUTHORS:
    5 
    6 - Marco Streng (2009-08-07)
    7 
    8 - Nick Alexander (2008-01-08)
    9 
    10 """
    11 #*****************************************************************************
    12 #       Copyright (C) 2008 Nick Alexander <ncalexander@gmail.com>
    13 #       Copyright (C) 2009 Marco Streng <marco.streng@gmail.com>
    14 #
    15 #  Distributed under the terms of the GNU General Public License (GPL)
    16 #
    17 #    This code is distributed in the hope that it will be useful,
    18 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
    19 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    20 #    General Public License for more details.
    21 #
    22 #  The full text of the GPL is available at:
    23 #
    24 #                  http://www.gnu.org/licenses/
    25 #*****************************************************************************
    26 
    27 from con_field import ProjectiveConic_field
    28 
    29 class ProjectiveConic_global_field(ProjectiveConic_field):
    30     r"""
    31     Create a projective plane conic curve over a global field.
    32     See ``Conic`` for full documentation.
    33    
    34     EXAMPLES::
    35    
    36         sage: K.<a> = NumberField(x^3 - 2, 'a')
    37         sage: P.<X, Y, Z> = K[]
    38         sage: Conic(X^2 + Y^2 - a*Z^2)
    39         Projective Conic Curve over Number Field in a with defining polynomial x^3 - 2 defined by X^2 + Y^2 + (-a)*Z^2
    40        
    41     TESTS::
    42    
    43         sage: K.<a> = NumberField(x^3 - 3, 'a')
    44         sage: Conic([a, 1, -1])._test_pickling()
    45     """
    46     def __init__(self, A, f):
    47         r"""
    48         See ``Conic`` for full documentation.
    49 
    50         EXAMPLES:
    51 
    52         ::
    53 
    54             sage: Conic([1, 1, 1])
    55             Projective Conic Curve over Rational Field defined by x^2 + y^2 + z^2
    56         """
    57         ProjectiveConic_field.__init__(self, A, f)
    58         # a single prime such that self has no point over the completion
    59         self._local_obstruction = None
    60         # all finite primes such that self has no point over the completion
    61         self._finite_obstructions = None
    62         # all infinite primes such that self has no point over the completion
    63         self._infinite_obstructions = None
    64 
    65 
    66     def is_locally_solvable(self, p):
    67         r"""
    68         Returns ``True`` if and only if ``self`` has a solution over the completion
    69         of the base field `B` of self at ``p``. Here ``p`` is a finite prime
    70         or infinite place of `B`.
    71 
    72         EXAMPLES:
    73 
    74         An example over `\QQ` ::
    75 
    76             sage: C = Conic(QQ, [1,2,3])
    77             sage: C.is_locally_solvable(-1)
    78             False
    79             sage: C.is_locally_solvable(2)
    80             False
    81             sage: C.is_locally_solvable(3)
    82             True
    83 
    84         An example over a number field ::
    85 
    86             sage: P.<x> = QQ[]
    87             sage: K.<a> = NumberField(x^3 + 5)
    88             sage: C = Conic(K, [1, 2, 3 - a])
    89             sage: [p1, p2] = K.places()
    90             sage: C.is_locally_solvable(p1)
    91             Traceback (most recent call last):
    92             ...
    93             NotImplementedError: is_locally_solvable not yet implemented for conics over number fields, please implement it using generalized_hilbert_symbol of Trac 9334
    94             sage: C.is_locally_solvable(p2)
    95             Traceback (most recent call last):
    96             ...
    97             NotImplementedError: is_locally_solvable not yet implemented for conics over number fields, please implement it using generalized_hilbert_symbol of Trac 9334
    98         """
    99         raise NotImplementedError, "please implement is_locally_solvable for " \
    100                                    "conics over global field %s" % B
    101 
    102     def local_obstructions(self, finite = True, infinite = True, read_cache = True):
    103         r"""
    104         Returns the sequence of finite primes and/or infinite places
    105         such that self is locally solvable at those primes and places.
    106        
    107         If the base field is `\QQ`, then the infinite place is denoted `-1`.
    108 
    109         The parameters ``finite`` and ``infinite`` (both ``True`` by default)
    110         are used to specify whether to look at finite and/or infinite places.
    111         Note that ``finite = True`` involves factorization of the determinant
    112         of self, hence may be slow.
    113        
    114         Local obstructions are cached. The parameter ``read_cache`` specifies
    115         whether to look at the cache before computing anything.
    116 
    117         EXAMPLES::
    118 
    119             sage: Conic(QQ, [1, 1, 1]).local_obstructions()
    120             [2, -1]
    121             sage: Conic(QQ, [1, 2, -3]).local_obstructions()
    122             []
    123             sage: Conic(QQ, [1, 2, 3, 4, 5, 6]).local_obstructions()
    124             [41, -1]
    125 
    126         """
    127         raise NotImplementedError, "please implement local_obstructions for " \
    128                                    "conics over global field %s" % B
    129 
  • sage/schemes/plane_conics/con_number_field.py

    diff -r 1139fd5c5a44 -r 7fadb062f931 sage/schemes/plane_conics/con_number_field.py
    a b  
    2727from sage.rings.all import is_RationalField
    2828from sage.rings.number_field.number_field import is_NumberField                           
    2929from sage.modules.free_module_element import vector
    30 from con_global_field import ProjectiveConic_global_field
     30from con_field import ProjectiveConic_field
    3131from rnfisnorm import _rnfisnorm
    3232
    33 class ProjectiveConic_number_field(ProjectiveConic_global_field):
     33class ProjectiveConic_number_field(ProjectiveConic_field):
    3434    r"""
    3535    Create a projective plane conic curve over a number field.
    3636    See ``Conic`` for full documentation.
     
    5656            sage: Conic([1, 1, 1])
    5757            Projective Conic Curve over Rational Field defined by x^2 + y^2 + z^2
    5858        """
    59         ProjectiveConic_global_field.__init__(self, A, f)
     59        ProjectiveConic_field.__init__(self, A, f)
     60        # a single prime such that self has no point over the completion
     61        self._local_obstruction = None
     62        # all finite primes such that self has no point over the completion
     63        self._finite_obstructions = None
     64        # all infinite primes such that self has no point over the completion
     65        self._infinite_obstructions = None
    6066
    6167
    6268    def has_rational_point(self, point = False, obstruction = False,
     
    154160            sage: M.<c> = NumberField(X^3+3*X+1)
    155161            sage: m = [[Q(b)(F.gen()) for b in a] for a in l for F in [K, L, M]]
    156162            sage: d = []
     163            sage: c = []
    157164            sage: c = [Conic(a) for a in m if a != [0,0,0]] # long time: 1 second
    158165            sage: d = [C.has_rational_point(algorithm = 'rnfisnorm', point = True) for C in c] # long time: 15 seconds
    159166            sage: assert all([c[k].defining_polynomial()(Sequence(d[k][1])) == 0 for k in range(len(c)) if d[k][0]])
     
    167174            sage: M.<c> = NumberField(x^5+3*x+1)
    168175            sage: m = [[F(b) for b in a] for a in l for F in [K, L, M]]
    169176            sage: c = [Conic(a) for a in m if a != [0,0,0] and a != [1,1,1] and a != [-1,-1,-1]] # long time 0.4 seconds
    170             sage: r = randrange(0, 5)
    171             sage: assert all([C.has_rational_point(algorithm = 'rnfisnorm') for C in c[r::5]]) # long time: 0.7 seconds
    172             sage: assert all([C.defining_polynomial()(Sequence(C.has_rational_point(point = True)[1])) == 0 for C in c[r::5]]) # uses cache, long time if previous line isn't run
     177            sage: assert all([C.has_rational_point(algorithm = 'rnfisnorm') for C in c]) # long time: 3.5 seconds
     178            sage: assert all([C.defining_polynomial()(Sequence(C.has_rational_point(point = True)[1])) == 0 for C in c]) # uses cache, long time if previous line isn't run
    173179        """
    174180        if read_cache:
    175181            if self._rational_point is not None:
  • sage/schemes/plane_conics/con_rational_field.py

    diff -r 1139fd5c5a44 -r 7fadb062f931 sage/schemes/plane_conics/con_rational_field.py
    a b  
    126126        and returns consistent answers for all algorithms. Check if all points returned are valid. ::
    127127
    128128            sage: l = Sequence(cartesian_product_iterator([[-1, 0, 1] for i in range(6)]))
    129             sage: l += [[QQ(randrange(-2,3)) for i in range(3)] for j in range(200)]
    130129            sage: c = [Conic(QQ, a) for a in l if a != [0,0,0] and a != (0,0,0,0,0,0)]
    131130            sage: d = []
    132131            sage: d = [[C]+[C.has_rational_point(algorithm = algorithm, read_cache = False, obstruction = (algorithm != 'rnfisnorm'), point = (algorithm != 'local')) for algorithm in ['local', 'qfsolve', 'rnfisnorm']] for C in c[::10]] # long time: 7 seconds
  • sage/schemes/plane_conics/constructor.py

    diff -r 1139fd5c5a44 -r 7fadb062f931 sage/schemes/plane_conics/constructor.py
    a b  
    4141from con_field import ProjectiveConic_field
    4242from con_finite_field import ProjectiveConic_finite_field
    4343from con_prime_finite_field import ProjectiveConic_prime_finite_field
    44 from con_global_field import ProjectiveConic_global_field
    4544from con_number_field import ProjectiveConic_number_field
    4645from con_rational_field import ProjectiveConic_rational_field
    4746
  • sage/schemes/plane_conics/rnfisnorm.py

    diff -r 1139fd5c5a44 -r 7fadb062f931 sage/schemes/plane_conics/rnfisnorm.py
    a b  
    7878   
    7979        sage: from sage.schemes.plane_conics.rnfisnorm import _rnfisnorm
    8080        sage: _rnfisnorm(5/4, 1/5)
     81        (True, (-1/2, -1/5))
    8182
    8283    Absolute number fields are interpreted as relative fields over `\QQ`.
    8384