Changeset 7456:f60ec7365b2b


Ignore:
Timestamp:
12/01/07 10:48:42 (6 years ago)
Author:
mabshoff@…
Branch:
default
Parents:
7454:0cb746e1a4bd (diff), 7455:3eda63e6eb1a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sage/rings/arith.py

    r7453 r7456  
    385385def valuation(m, p): 
    386386    """ 
    387     The exact power of p>0 that divides the integer m. 
    388     We do not require that p be prime, and if m is 0, 
    389     then this function returns rings.infinity. 
    390      
    391     EXAMPLES:: 
    392  
     387    The exact power of p that divides m. 
     388     
     389    m should be an integer or rational (but maybe other types 
     390    work too.) 
     391 
     392    This actually just calls the m.valuation() method. 
     393 
     394    If m is 0, this function returns rings.infinity. 
     395 
     396    EXAMPLES: 
    393397        sage: valuation(512,2) 
    394398        9 
    395399        sage: valuation(1,2) 
    396400        0 
    397  
    398     Valuation of 0 is defined, but valuation with respect to 0 is not:: 
    399  
     401        sage: valuation(5/9, 3) 
     402        -2 
     403 
     404    Valuation of 0 is defined, but valuation with respect to 0 is not: 
    400405        sage: valuation(0,7) 
    401406        +Infinity 
     
    403408        Traceback (most recent call last): 
    404409        ... 
    405         ValueError: valuation at 0 not defined 
    406  
    407     Here are some other example:: 
    408      
     410        ValueError: You can only compute the valuation with respect to a integer larger than 1. 
     411 
     412    Here are some other examples: 
    409413        sage: valuation(100,10) 
    410414        2 
     
    418422        1 
    419423    """ 
    420     if p <= 0: 
    421         raise ValueError, "valuation at 0 not defined" 
    422     if m == 0: 
    423         import sage.rings.all 
    424         return sage.rings.all.infinity 
    425     r=0 
    426     power=p 
    427     while m%power==0: 
    428         r += 1 
    429         power *= p 
    430     return r 
     424    return m.valuation(p) 
    431425 
    432426 
  • sage/rings/arith.py

    r7455 r7456  
    281281    r""" 
    282282    Returns True if $x$ is prime, and False otherwise.  The result 
    283     is proven correct -- {\em this is NOT a pseudo-primality test!}. 
     283    is proven correct -- \emph{this is NOT a pseudo-primality test!}. 
    284284     
    285285    INPUT: 
     
    317317    r""" 
    318318    Returns True if $x$ is a pseudo-prime, and False otherwise.  The result 
    319     is \em{NOT} proven correct -- {\em this is a pseudo-primality test!}. 
     319    is \emph{NOT} proven correct -- \emph{this is a pseudo-primality test!}. 
    320320     
    321321    INPUT: 
     
    353353    r""" 
    354354    Returns True if $x$ is a prime power, and False otherwise. 
    355     The result is proven correct -- {\em this is NOT a 
     355    The result is proven correct -- \emph{this is NOT a 
    356356    pseudo-primality test!}. 
    357357 
     
    15241524        The qsieve and ecm commands give access to highly optimized 
    15251525        implementations of algorithms for doing certain integer 
    1526         factorization problems.  These implementation are not used by 
     1526        factorization problems.  These implementations are not used by 
    15271527        the generic factor command, which currently just calls PARI 
    15281528        (note that PARI also implements sieve and ecm algorithms, but 
     
    23862386        [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1] 
    23872387        sage: continued_fraction_list(sqrt(4/19)) 
    2388         [0, 2, 5, 1, 1, 2, 1, 16, 1, 2, 1, 1, 5, 4, 5, 1, 1, 2, 1, 18] 
     2388        [0, 2, 5, 1, 1, 2, 1, 16, 1, 2, 1, 1, 5, 4, 5, 1, 1, 2, 1, 15, 2] 
    23892389        sage: continued_fraction_list(RR(pi), partial_convergents=True) 
    23902390        ([3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 3], 
Note: See TracChangeset for help on using the changeset viewer.