Ticket #9068: trac_9068-sgn.patch

File trac_9068-sgn.patch, 2.6 KB (added by cremona, 12 years ago)

Applies to 4.4.3.alpha0

  • sage/quadratic_forms/extras.py

    # HG changeset patch
    # User John Cremona <john.cremona@gmail.com>
    # Date 1274994734 -3600
    # Node ID ddd2fef62515d69f9e0ae56bd252fbd7c181310c
    # Parent  3ba8c82fd4fb8fb98027bfa6858328289890f5c9
    #9068 - remove redundant sgn() function from quadratic_forms/extras.py
    
    diff -r 3ba8c82fd4fb -r ddd2fef62515 sage/quadratic_forms/extras.py
    a b  
    88from sage.rings.infinity import infinity
    99from sage.misc.functional import squarefree_part
    1010
    11 def sgn(x):
    12     """
    13     Returns the sign of x. defined as:
    14 
    15                    /  1  if  x > 0,
    16         sgn(x) =   |  0  if  x = 0,
    17                    \ -1  if  x < 0.
    18 
    19     INPUT:
    20         a real number
    21 
    22     OUTPUT:
    23         1, 0, or -1.
    24 
    25     EXAMPLES:
    26        
    27         sage: from sage.quadratic_forms.extras import sgn
    28         sage: sgn(pi) == 1
    29         True
    30         sage: sgn(5/6) == 1
    31         True
    32         sage: sgn(0) == 0
    33         True
    34         sage: sgn(-3) == -1
    35         True
    36     """
    37     return ZZ(cmp(x,0))
    38 
    3911def is_triangular_number(n):
    4012    """
    4113    Determines if the integer n is a triangular number.
  • sage/quadratic_forms/quadratic_form__local_field_invariants.py

    diff -r 3ba8c82fd4fb -r ddd2fef62515 sage/quadratic_forms/quadratic_form__local_field_invariants.py
    a b  
    2828from sage.rings.rational_field import QQ
    2929from sage.rings.real_mpfr import RR
    3030from sage.rings.arith import prime_divisors, valuation, hilbert_symbol
    31 from sage.quadratic_forms.extras import sgn
     31from sage.functions.all import sgn
    3232from sage.rings.fraction_field import FractionField
    3333from sage.matrix.matrix_space import MatrixSpace
    3434from sage.rings.arith import GCD
  • sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py

    diff -r 3ba8c82fd4fb -r ddd2fef62515 sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py
    a b  
    1717from sage.rings.finite_rings.integer_mod_ring import IntegerModRing
    1818from sage.rings.rational_field import QQ
    1919from sage.rings.arith import legendre_symbol, kronecker, prime_divisors
    20 from sage.quadratic_forms.extras import sgn
     20from sage.functions.all import sgn
    2121from sage.quadratic_forms.special_values import gamma__exact, zeta__exact, quadratic_L_function__exact
    2222from sage.misc.functional import squarefree_part
    2323from sage.symbolic.constants import pi