Changeset 7471:88bbf02feb71


Ignore:
Timestamp:
12/01/07 18:46:25 (5 years ago)
Author:
Mike Hansen <mhansen@…>
Branch:
default
Message:

Fixed doctest failures caused by #962.

Location:
sage
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • sage/calculus/calculus.py

    r7458 r7471  
    43224322 
    43234323            sage: RR(sin(pi)) 
    4324             0.000000000000000122464679914735 
    4325              
     4324            1.22464679914735e-16 
     4325 
    43264326            sage: type(RR(sqrt(163)*pi)) 
    43274327            <type 'sage.rings.real_mpfr.RealNumber'> 
     
    46044604        x 
    46054605        sage: a = floor(5.4 + x); a 
    4606         floor(x + 0.4000000000000004) + 5 
     4606        floor(x + 0.400000000000000) + 5 
    46074607        sage: a(2) 
    46084608        7         
     
    48074807        pi/6 
    48084808        sage: asin(1 + I*1.0) 
    4809         1.061275061905036*I + 0.6662394324925153 
     4809        1.061275061905036*I + 0.666239432492515 
    48104810    """ 
    48114811    def _repr_(self, simplify=True): 
     
    48314831        asinh(1/2) 
    48324832        sage: asinh(1 + I*1.0) 
    4833         0.6662394324925153*I + 1.061275061905036 
     4833        0.666239432492515*I + 1.061275061905036 
    48344834    """ 
    48354835    def _repr_(self, simplify=True): 
     
    48534853        acosh(1/2) 
    48544854        sage: acosh(1 + I*1.0) 
    4855         0.9045568943023813*I + 1.061275061905036 
     4855        0.904556894302381*I + 1.061275061905036 
    48564856 
    48574857    Warning: If the input is real the output will be real or NaN: 
     
    48864886        atanh(1/2) 
    48874887        sage: atanh(1 + I*1.0) 
    4888         1.017221967897851*I + 0.4023594781085251 
     4888        1.017221967897851*I + 0.402359478108525 
    48894889    """ 
    48904890    def _repr_(self, simplify=True): 
     
    49104910        pi/3 
    49114911        sage: acos(1 + I*1.0) 
    4912         0.9045568943023813 - 1.061275061905036*I 
     4912        0.904556894302381 - 1.061275061905036*I 
    49134913    """ 
    49144914    def _repr_(self, simplify=True): 
  • sage/calculus/wester.py

    r7352 r7471  
    2626e^(sqrt(163)*pi) 
    2727sage: print RealField(150)(a) 
    28 262537412640768743.99999999999925007259719819 
     282.6253741264076874399999999999925007259719819e17 
    2929 
    3030sage: # Evaluate the Bessel function J[2] numerically at z=1+I. 
  • sage/functions/constants.py

    r7430 r7471  
    540540        2*%i 
    541541        sage: 1e8*I 
    542         100000000.000000*I 
     542        1.00000000000000e8*I 
    543543    """ 
    544544    def __init__(self): 
  • sage/gsl/dft.py

    r4063 r7471  
    331331            sage: A = [exp(-2*pi*i*I/5) for i in J] 
    332332            sage: s = IndexedSequence(A,J) 
     333 
    333334            sage: s.dst()        # discrete sine 
    334             Indexed sequence: [0.000000000000000111022302462516 - 2.50000000000000*I, 0.000000000000000111022302462516 - 2.50000000000000*I, 0.000000000000000111022302462516 - 2.50000000000000*I, 0.000000000000000111022302462516 - 2.50000000000000*I, 0.000000000000000111022302462516 - 2.50000000000000*I] 
    335                 indexed by [0, 1, 2, 3, 4]             
     335            Indexed sequence: [1.11022302462516e-16 - 2.50000000000000*I, 1.11022302462516e-16 - 2.50000000000000*I, 1.11022302462516e-16 - 2.50000000000000*I, 1.11022302462516e-16 - 2.50000000000000*I, 1.11022302462516e-16 - 2.50000000000000*I] 
     336                indexed by [0, 1, 2, 3, 4] 
    336337        """ 
    337338        F = self.base_ring()   ## elements must be coercible into RR 
  • sage/interfaces/gp.py

    r7315 r7471  
    366366             11243.9812000000 + 15.0000000000000*I 
    367367            sage: ComplexField(10)(gp(11243.9812+15*I)) 
    368              1.1e4 + 15.*I 
     368             11000. + 15.*I 
    369369        """ 
    370370        GP = self.parent() 
  • sage/misc/functional.py

    r7470 r7471  
    714714        12.5878862295484 
    715715        sage: n(pi^2 + e, digits=50) 
    716         12.5878862295484038541947784712288136330709465009407 
     716        12.587886229548403854194778471228813633070946500941 
    717717 
    718718    You can also usually use method notation: 
  • sage/modular/dirichlet.py

    r5477 r7471  
    669669            sage: e = G.0 
    670670            sage: e.gauss_sum_numerical() 
    671             0.000000000000000555111512312578 + 1.73205080756888*I 
     671            5.55111512312578e-16 + 1.73205080756888*I 
    672672            sage: abs(e.gauss_sum_numerical()) 
    673673            1.73205080756888 
     
    675675            1.73205080756888 
    676676            sage: e.gauss_sum_numerical(a=2) 
    677             -0.00000000000000111022302462516 - 1.73205080756888*I 
     677            -1.11022302462516e-15 - 1.73205080756888*I 
    678678            sage: e.gauss_sum_numerical(a=2, prec=100) 
    679             0.0000000000000000000000000000047331654313260708324703713917 - 1.7320508075688772935274463415*I 
     679            4.7331654313260708324703713917e-30 - 1.7320508075688772935274463415*I 
    680680            sage: G = DirichletGroup(13) 
    681681            sage: e = G.0 
  • sage/rings/arith.py

    r7457 r7471  
    7171        (x + 1) * x^2 * (x^2 - x + 1) 
    7272        sage: z^2 - z + 1 
    73         0.000000000000000111022302462516 
     73        1.11022302462516e-16 
    7474 
    7575    This example involves a $p$-adic number. 
  • sage/rings/complex_interval.pyx

    r7425 r7471  
    483483            sage: a = ~(5+I) 
    484484            sage: a * (5+I) 
    485             [0.99999999999999988 .. 1.0000000000000003] + [-0.000000000000000027755575615628914 .. 0.000000000000000055511151231257828]*I 
     485            [0.99999999999999988 .. 1.0000000000000003] + [-2.7755575615628914e-17 .. 5.5511151231257828e-17]*I 
    486486        """ 
    487487        cdef ComplexIntervalFieldElement x 
  • sage/rings/complex_number.pyx

    r7425 r7471  
    874874            (x + 1) * x^2 * (x^2 - x + 1) 
    875875            sage: z^2 - z + 1 
    876             0.000000000000000111022302462516 
     876            1.11022302462516e-16 
    877877        """ 
    878878        import sage.rings.arith 
  • sage/rings/contfrac.py

    r4257 r7471  
    3030    245850922/78256779 
    3131    sage: RealField(200)(QQ(c) - pi) 
    32     -0.000000000000000078179366199075435400152113059910891481153981448107195930950 
     32    -7.8179366199075435400152113059910891481153981448107195930950e-17 
    3333 
    3434We can also create matrices, polynomials, vectors, etc., over the continued 
  • sage/rings/fraction_field_element.py

    r6528 r7471  
    126126            (1.0000*x^4 + 4.0000*x^2 + 1.0000*x + 3.0000)/(1.0000*x^5 - 1.0000*x^4 + 4.0000*x^3 - 4.0000*x^2 + 4.0000*x - 4.0000) 
    127127            sage: whole, parts = q.partial_fraction_decomposition(); parts 
    128             [(-0.0000076294*x^2 + 1.0000)/(1.0000*x^4 + 4.0000*x^2 + 4.0000), 1.0000/(1.0000*x - 1.0000)] 
     128            [(-7.6294e-6*x^2 + 1.0000)/(1.0000*x^4 + 4.0000*x^2 + 4.0000), 1.0000/(1.0000*x - 1.0000)] 
    129129            sage: sum(parts) 
    130             (1.0000*x^4 - 0.0000076294*x^3 + 4.0000*x^2 + 1.0000*x + 3.0000)/(1.0000*x^5 - 1.0000*x^4 + 4.0000*x^3 - 4.0000*x^2 + 4.0000*x - 4.0000) 
    131          
     130            (1.0000*x^4 - 7.6294e-6*x^3 + 4.0000*x^2 + 1.0000*x + 3.0000)/(1.0000*x^5 - 1.0000*x^4 + 4.0000*x^3 - 4.0000*x^2 + 4.0000*x - 4.0000)         
    132131        AUTHOR:  
    133132            -- Robert Bradshaw (2007-05-31) 
  • sage/rings/integer.pyx

    r7317 r7471  
    6969    sage: RR = RealField(200) 
    7070    sage: RR(n) 
    71     9390823.0000000000000000000000000000000000000000000000000000 
     71    9.3908230000000000000000000000000000000000000000000000000000e6 
    7272 
    7373""" 
  • sage/rings/number_field/number_field.py

    r7442 r7471  
    37733773              To:   Complex Field with 58 bits of precision 
    37743774              Defn: a |--> -0.62996052494743676 - 1.0911236359717214*I 
    3775                     b |--> -0.00000000000000019428902930940239 + 1.0000000000000000*I,  
    3776               ...         
     3775                    b |--> -1.9428902930940239e-16 + 1.0000000000000000*I, Relative number field morphism: 
     3776              ... 
     3777              From: Number Field in a with defining polynomial x^3 - 2 over its base field 
    37773778              To:   Complex Field with 58 bits of precision 
    37783779              Defn: a |--> 1.2599210498948731 
    37793780                    b |--> -0.99999999999999999*I] 
    37803781            sage: f[0](a)^3 
    3781             2.0000000000000002 - 0.00000000000000086389229103644993*I 
     3782            2.0000000000000002 - 8.6389229103644993e-16*I 
    37823783            sage: f[0](b)^2 
    3783             -1.0000000000000001 - 0.00000000000000038857805861880480*I 
     3784            -1.0000000000000001 - 3.8857805861880480e-16*I 
    37843785            sage: f[0](a+b) 
    37853786            -0.62996052494743693 - 0.091123635971721295*I 
     
    44274428            sage: C.complex_embeddings() 
    44284429            [Ring morphism: 
    4429               From: Cyclotomic Field of order 4 and degree 2 
    4430               To:   Complex Field with 53 bits of precision 
    4431               Defn: zeta4 |--> 6.12323399573677e-17 + 1.00000000000000*I, Ring morphism: 
    4432               From: Cyclotomic Field of order 4 and degree 2 
    4433               To:   Complex Field with 53 bits of precision 
    4434               Defn: zeta4 |--> -0.000000000000000183697019872103 - 1.00000000000000*I] 
     4430             From: Cyclotomic Field of order 4 and degree 2 
     4431             To:   Complex Field with 53 bits of precision 
     4432             Defn: zeta4 |--> 6.12323399573677e-17 + 1.00000000000000*I, Ring morphism: 
     4433             From: Cyclotomic Field of order 4 and degree 2 
     4434             To:   Complex Field with 53 bits of precision 
     4435             Defn: zeta4 |--> -1.83697019872103e-16 - 1.00000000000000*I] 
    44354436        """ 
    44364437        CC = sage.rings.complex_field.ComplexField(prec) 
  • sage/rings/polynomial/complex_roots.py

    r7469 r7471  
    5050        [0.76604444311897801 .. 0.76604444311897802] + [0.64278760968653925 .. 0.64278760968653926]*I 
    5151        sage: ip(irt) 
    52         [-0.0000000000000013322676295501879 .. 0.00000000000000066613381477509393] + [-0.0000000000000012212453270876722 .. 0.00000000000000066613381477509393]*I 
     52        [-1.3322676295501879e-15 .. 6.6613381477509393e-16] + [-1.2212453270876722e-15 .. 6.6613381477509393e-16]*I 
    5353        sage: ipd(irt) 
    5454        [6.8943999880707931 .. 6.8943999880708056] - [5.7850884871788474 .. 5.7850884871788600]*I 
  • sage/rings/polynomial/polynomial_element.pyx

    r7469 r7471  
    10761076            sage: f = y^10 - 1.393493*y + 0.3 
    10771077            sage: f._mul_karatsuba(f) 
    1078             1.00000000000000*y^20 - 2.78698600000000*y^11 + 0.600000000000000*y^10 + 0.000000000000000111022302462516*y^8 - 0.000000000000000111022302462516*y^6 - 0.000000000000000111022302462516*y^3 + 1.94182274104900*y^2 - 0.836095800000000*y + 0.0900000000000000 
     1078            1.00000000000000*y^20 - 2.78698600000000*y^11 + 0.600000000000000*y^10 + 1.11022302462516e-16*y^8 - 1.11022302462516e-16*y^6 - 1.11022302462516e-16*y^3 + 1.94182274104900*y^2 - 0.836095800000000*y + 0.0900000000000000 
    10791079            sage: f._mul_fateman(f) 
    10801080            1.00000000000000*y^20 - 2.78698600000000*y^11 + 0.600000000000000*y^10 + 1.94182274104900*y^2 - 0.836095800000000*y + 0.0900000000000000 
  • sage/rings/polynomial/real_roots.pyx

    r7428 r7471  
    27332733        sage: bps = split_for_targets(ctx, bp, [(rr_gap(1/1234567893, 1/1234567892, 1), rr_gap(1/1234567891, 1/1234567890, 1), 12), (rr_gap(1/3, 1/2, -1), rr_gap(2/3, 3/4, -1), 6)]) 
    27342734        sage: str(bps[0]) 
    2735         '<IBP: (999992, 999992, 999992) + [0 .. 15) over [8613397477114467984778830327/10633823966279326983230456482242756608 .. 591908168025934394813836527495938294787/730750818665451459101842416358141509827966271488]; level 2; slope_err [-192592590990.49338 .. 192592590990.49338]>' 
     2735        '<IBP: (999992, 999992, 999992) + [0 .. 15) over [8613397477114467984778830327/10633823966279326983230456482242756608 .. 591908168025934394813836527495938294787/730750818665451459101842416358141509827966271488]; level 2; slope_err [-1.9259259099049338e11 .. 1.9259259099049338e11]>' 
    27362736        sage: str(bps[1]) 
    27372737        '<IBP: (-1562500, -1875001, -2222223, -2592593, -2969137, -3337450) + [0 .. 4) over [1/2 .. 2863311531/4294967296]>' 
  • sage/rings/qqbar.py

    r7428 r7471  
    273273    [2.6420403358193503e44 .. 2.6420403358193520e44] 
    274274    sage: lhs - rhs 
    275     [-79344219392947342000000000000. .. 81800756658404269000000000000.] 
     275    [-7.9344219392947342e28 .. 8.1800756658404269e28] 
    276276    sage: lhs == rhs 
    277277    True 
     
    19301930            x^4 - 10*x^2 + 1 
    19311931            sage: p(RR(v.real())) 
    1932             0.0000000000000131006316905768 
     1932            1.31006316905768e-14 
    19331933        """ 
    19341934        try: 
     
    29562956            x^6 + 2*x^5 + 4*x^4 + 8*x^3 + 16*x^2 + 32*x + 64 
    29572957            sage: a.minpoly()(a) 
    2958             [-0.00000000000000031918911957973251 .. 0.00000000000000034694469519536142] + [-0.00000000000000033133218391157016 .. 0.00000000000000032786273695961655]*I 
     2958            [-3.1918911957973251e-16 .. 3.4694469519536142e-16] + [-3.3133218391157016e-16 .. 3.2786273695961655e-16]*I 
    29592959            sage: a.minpoly()(a) == 0 
    29602960            True 
  • sage/rings/rational.pyx

    r7455 r7471  
    565565            1.29099444873581 
    566566            sage: (990829038092384908234098239048230984/4).sqrt_approx() 
    567             497701978620837137.47374920870362581922510725585130996993055116540856385 
     567            4.9770197862083713747374920870362581922510725585130996993055116540856385e17 
    568568            sage: (5/3).sqrt_approx(prec=200) 
    569569            1.2909944487358056283930884665941332036109739017638636088625 
  • sage/rings/real_mpfi.pyx

    r7428 r7471  
    266266        1.38777878078144e-17 
    267267        sage: outward.upper() - nearest.upper() 
    268         0.000000000000000111022302462516 
     268        1.11022302462516e-16 
    269269 
    270270    Some examples with a real interval field of higher precision: 
     
    10231023            0.666666666666667 
    10241024            sage: RIF(pi).diameter() 
    1025             0.000000000000000141357985842823 
     1025            1.41357985842823e-16 
    10261026            sage: RIF(pi).absolute_diameter() 
    1027             0.000000000000000444089209850063 
     1027            4.44089209850063e-16 
    10281028            sage: RIF(pi).relative_diameter() 
    1029             0.000000000000000141357985842823 
     1029            1.41357985842823e-16 
    10301030            sage: (RIF(pi) - RIF(3, 22/7)).diameter() 
    10311031            0.142857142857144 
     
    13171317        EXAMPLES: 
    13181318            sage: RIF(1.0) << 32 
    1319             [4294967296.0000000 .. 4294967296.0000000] 
     1319            [4.2949672960000000e9 .. 4.2949672960000000e9] 
    13201320        """ 
    13211321        if isinstance(x, RealIntervalFieldElement) and isinstance(y, (int,long, Integer)): 
     
    20452045            True 
    20462046            sage: r.sqrt()^2 - r             
    2047             [-0.00000000000090949470177292824 .. 0.0000000000018189894035458565] 
     2047            [-9.0949470177292824e-13 .. 1.8189894035458565e-12] 
    20482048 
    20492049            sage: r = RIF(-2.0) 
     
    22352235            sage: r = RIF(32.3) 
    22362236            sage: a = r.exp(); a 
    2237             [106588847274864.46 .. 106588847274864.49] 
     2237            [1.0658884727486446e14 .. 1.0658884727486449e14] 
    22382238            sage: a.log() 
    22392239            [32.299999999999990 .. 32.300000000000005] 
     
    22412241            sage: r = RIF(-32.3) 
    22422242            sage: r.exp() 
    2243             [0.0000000000000093818445884986834 .. 0.0000000000000093818445884986851] 
     2243            [9.3818445884986834e-15 .. 9.3818445884986851e-15] 
    22442244        """ 
    22452245        cdef RealIntervalFieldElement x 
     
    22612261            sage: r = RIF(32.0) 
    22622262            sage: r.exp2() 
    2263             [4294967296.0000000 .. 4294967296.0000000] 
     2263            [4.2949672960000000e9 .. 4.2949672960000000e9]             
    22642264 
    22652265            sage: r = RIF(-32.3) 
    22662266            sage: r.exp2() 
    2267             [0.00000000018911724825302069 .. 0.00000000018911724825302073] 
    2268  
     2267            [1.8911724825302069e-10 .. 1.8911724825302073e-10] 
    22692268        """ 
    22702269        cdef RealIntervalFieldElement x 
     
    23372336            sage: t=RIF(pi)/2 
    23382337            sage: t.cos() 
    2339             [-0.00000000000000016081226496766367 .. 0.000000000000000061232339957367661] 
     2338            [-1.6081226496766367e-16 .. 6.1232339957367661e-17] 
    23402339            sage: t.cos().cos() 
    23412340            [0.99999999999999988 .. 1.0000000000000000] 
     
    24262425            False 
    24272426            sage: q - q2 
    2428             [-0.00000000000000044408920985006262 .. 0.00000000000000044408920985006262] 
     2427            [-4.4408920985006262e-16 .. 4.4408920985006262e-16] 
    24292428            sage: q in q2 
    24302429            True 
     
    24552454            False 
    24562455            sage: q - q2 
    2457             [-0.00000000000000022204460492503131 .. 0.00000000000000022204460492503131] 
     2456            [-2.2204460492503131e-16 .. 2.2204460492503131e-16] 
    24582457            sage: q in q2 
    24592458            True 
     
    24842483            False 
    24852484            sage: q - q2 
    2486             [-0.00000000000000022204460492503131 .. 0.00000000000000022204460492503131] 
     2485            [-2.2204460492503131e-16 .. 2.2204460492503131e-16] 
    24872486            sage: q in q2 
    24882487            True 
     
    25682567            [0.46401763049299088 .. 0.46401763049299106] 
    25692568            sage: i.asinh() - q 
    2570             [-0.00000000000000016653345369377349 .. 0.00000000000000016653345369377349] 
     2569            [-1.6653345369377349e-16 .. 1.6653345369377349e-16] 
    25712570        """ 
    25722571        cdef RealIntervalFieldElement x 
     
    25862585            [0.42091124104853488 .. 0.42091124104853501] 
    25872586            sage: i.atanh() - q 
    2588             [-0.00000000000000016653345369377349 .. 0.00000000000000016653345369377349] 
     2587            [-1.6653345369377349e-16 .. 1.6653345369377349e-16] 
    25892588        """ 
    25902589        cdef RealIntervalFieldElement x 
     
    28412840        [1.000000000000000000000000000000000000 .. 1.000000000000000000000000000000000000] 
    28422841        sage: RealInterval(29308290382930840239842390482, 3^20) 
    2843         [3486784401.00000000000000000000 .. 29308290382930840239842390482.0] 
     2842        [3.48678440100000000000000000000e9 .. 2.93082903829308402398423904820e28] 
    28442843    """ 
    28452844    if not isinstance(s, str): 
  • sage/rings/real_mpfr.pyx

    r7470 r7471  
    1818 
    1919    sage: RR(sys.maxint) 
    20     9223372036854780000.     # 64-bit 
    21     2147483647.00000         # 32-bit 
     20    9.22337203685478e18      # 64-bit 
     21    2.14748364700000e9       # 32-bit 
    2222 
    2323TESTS: 
     
    853853            sage: b = 2.0^99 
    854854            sage: b.str() 
    855             '633825300114115000000000000000.' 
     855            '6.33825300114115e29' 
    856856            sage: b.str(no_sci=False) 
    857857            '6.33825300114115e29' 
    858858            sage: b.str(no_sci=True) 
    859             '633825300114115000000000000000.' 
     859            '6.33825300114115e29' 
    860860            sage: c = 2.0^100 
    861861            sage: c.str() 
     
    868868            '1267650600228230000000000000000.' 
    869869            sage: 0.5^53 
    870             0.000000000000000111022302462516 
     870            1.11022302462516e-16 
    871871            sage: 0.5^54 
    872872            5.55111512312578e-17 
     
    928928        t = str(s) 
    929929        mpfr_free_str(s) 
    930          
    931930         
    932931        cdef int digits 
     
    10281027        A big number with no decimal point: 
    10291028            sage: a = RR(10^17); a 
    1030             100000000000000000. 
     1029            1.00000000000000e17 
    10311030            sage: a.integer_part() 
    10321031            100000000000000000 
     
    11561155        EXAMPLES: 
    11571156            sage: 1.0 << 32 
    1158             4294967296.00000 
     1157            4.29496729600000e9 
    11591158            sage: 1.5 << 2.5 
    11601159            Traceback (most recent call last): 
     
    20802079            sage: r = -119.0 
    20812080            sage: r.cube_root()^3 - r       # illustrates precision loss 
    2082             -0.0000000000000142108547152020 
     2081            -1.42108547152020e-14 
    20832082        """ 
    20842083        cdef RealNumber x 
     
    22262225            sage: r = 32.3 
    22272226            sage: a = r.exp(); a 
    2228             106588847274864. 
     2227            1.06588847274864e14 
    22292228            sage: a.log() 
    22302229            32.3000000000000 
     
    22322231            sage: r = -32.3 
    22332232            sage: r.exp() 
    2234             0.00000000000000938184458849869 
     2233            9.38184458849869e-15 
    22352234        """ 
    22362235        cdef RealNumber x 
     
    22522251            sage: r = 32.0 
    22532252            sage: r.exp2() 
    2254             4294967296.00000 
     2253            4.29496729600000e9 
    22552254 
    22562255            sage: r = -32.3 
    22572256            sage: r.exp2() 
    2258             0.000000000189117248253021 
     2257            1.89117248253021e-10 
    22592258 
    22602259        """ 
Note: See TracChangeset for help on using the changeset viewer.