# Changeset 7471:88bbf02feb71

Ignore:
Timestamp:
12/01/07 18:46:25 (5 years ago)
Branch:
default
Message:

Fixed doctest failures caused by #962.

Location:
sage
Files:
21 edited

Unmodified
Removed
• ## sage/calculus/calculus.py

 r7458 sage: RR(sin(pi)) 0.000000000000000122464679914735 1.22464679914735e-16 sage: type(RR(sqrt(163)*pi)) x sage: a = floor(5.4 + x); a floor(x + 0.4000000000000004) + 5 floor(x + 0.400000000000000) + 5 sage: a(2) 7 pi/6 sage: asin(1 + I*1.0) 1.061275061905036*I + 0.6662394324925153 1.061275061905036*I + 0.666239432492515 """ def _repr_(self, simplify=True): asinh(1/2) sage: asinh(1 + I*1.0) 0.6662394324925153*I + 1.061275061905036 0.666239432492515*I + 1.061275061905036 """ def _repr_(self, simplify=True): acosh(1/2) sage: acosh(1 + I*1.0) 0.9045568943023813*I + 1.061275061905036 0.904556894302381*I + 1.061275061905036 Warning: If the input is real the output will be real or NaN: atanh(1/2) sage: atanh(1 + I*1.0) 1.017221967897851*I + 0.4023594781085251 1.017221967897851*I + 0.402359478108525 """ def _repr_(self, simplify=True): pi/3 sage: acos(1 + I*1.0) 0.9045568943023813 - 1.061275061905036*I 0.904556894302381 - 1.061275061905036*I """ def _repr_(self, simplify=True):
• ## sage/calculus/wester.py

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

 r7430 2*%i sage: 1e8*I 100000000.000000*I 1.00000000000000e8*I """ def __init__(self):
• ## sage/gsl/dft.py

 r4063 sage: A = [exp(-2*pi*i*I/5) for i in J] sage: s = IndexedSequence(A,J) sage: s.dst()        # discrete sine 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] indexed by [0, 1, 2, 3, 4] 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] indexed by [0, 1, 2, 3, 4] """ F = self.base_ring()   ## elements must be coercible into RR
• ## sage/interfaces/gp.py

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

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

 r5477 sage: e = G.0 sage: e.gauss_sum_numerical() 0.000000000000000555111512312578 + 1.73205080756888*I 5.55111512312578e-16 + 1.73205080756888*I sage: abs(e.gauss_sum_numerical()) 1.73205080756888 1.73205080756888 sage: e.gauss_sum_numerical(a=2) -0.00000000000000111022302462516 - 1.73205080756888*I -1.11022302462516e-15 - 1.73205080756888*I sage: e.gauss_sum_numerical(a=2, prec=100) 0.0000000000000000000000000000047331654313260708324703713917 - 1.7320508075688772935274463415*I 4.7331654313260708324703713917e-30 - 1.7320508075688772935274463415*I sage: G = DirichletGroup(13) sage: e = G.0
• ## sage/rings/arith.py

 r7457 (x + 1) * x^2 * (x^2 - x + 1) sage: z^2 - z + 1 0.000000000000000111022302462516 1.11022302462516e-16 This example involves a \$p\$-adic number.
• ## sage/rings/complex_interval.pyx

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

 r7425 (x + 1) * x^2 * (x^2 - x + 1) sage: z^2 - z + 1 0.000000000000000111022302462516 1.11022302462516e-16 """ import sage.rings.arith
• ## sage/rings/contfrac.py

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

 r6528 (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) sage: whole, parts = q.partial_fraction_decomposition(); parts [(-0.0000076294*x^2 + 1.0000)/(1.0000*x^4 + 4.0000*x^2 + 4.0000), 1.0000/(1.0000*x - 1.0000)] [(-7.6294e-6*x^2 + 1.0000)/(1.0000*x^4 + 4.0000*x^2 + 4.0000), 1.0000/(1.0000*x - 1.0000)] sage: sum(parts) (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) (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) AUTHOR: -- Robert Bradshaw (2007-05-31)
• ## sage/rings/integer.pyx

 r7317 sage: RR = RealField(200) sage: RR(n) 9390823.0000000000000000000000000000000000000000000000000000 9.3908230000000000000000000000000000000000000000000000000000e6 """
• ## sage/rings/number_field/number_field.py

 r7442 To:   Complex Field with 58 bits of precision Defn: a |--> -0.62996052494743676 - 1.0911236359717214*I b |--> -0.00000000000000019428902930940239 + 1.0000000000000000*I, ... b |--> -1.9428902930940239e-16 + 1.0000000000000000*I, Relative number field morphism: ... From: Number Field in a with defining polynomial x^3 - 2 over its base field To:   Complex Field with 58 bits of precision Defn: a |--> 1.2599210498948731 b |--> -0.99999999999999999*I] sage: f[0](a)^3 2.0000000000000002 - 0.00000000000000086389229103644993*I 2.0000000000000002 - 8.6389229103644993e-16*I sage: f[0](b)^2 -1.0000000000000001 - 0.00000000000000038857805861880480*I -1.0000000000000001 - 3.8857805861880480e-16*I sage: f[0](a+b) -0.62996052494743693 - 0.091123635971721295*I sage: C.complex_embeddings() [Ring morphism: From: Cyclotomic Field of order 4 and degree 2 To:   Complex Field with 53 bits of precision Defn: zeta4 |--> 6.12323399573677e-17 + 1.00000000000000*I, Ring morphism: From: Cyclotomic Field of order 4 and degree 2 To:   Complex Field with 53 bits of precision Defn: zeta4 |--> -0.000000000000000183697019872103 - 1.00000000000000*I] From: Cyclotomic Field of order 4 and degree 2 To:   Complex Field with 53 bits of precision Defn: zeta4 |--> 6.12323399573677e-17 + 1.00000000000000*I, Ring morphism: From: Cyclotomic Field of order 4 and degree 2 To:   Complex Field with 53 bits of precision Defn: zeta4 |--> -1.83697019872103e-16 - 1.00000000000000*I] """ CC = sage.rings.complex_field.ComplexField(prec)
• ## sage/rings/polynomial/complex_roots.py

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

 r7469 sage: f = y^10 - 1.393493*y + 0.3 sage: f._mul_karatsuba(f) 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 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 sage: f._mul_fateman(f) 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 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)]) sage: str(bps[0]) '' '' sage: str(bps[1]) ''
• ## sage/rings/qqbar.py

 r7428 [2.6420403358193503e44 .. 2.6420403358193520e44] sage: lhs - rhs [-79344219392947342000000000000. .. 81800756658404269000000000000.] [-7.9344219392947342e28 .. 8.1800756658404269e28] sage: lhs == rhs True x^4 - 10*x^2 + 1 sage: p(RR(v.real())) 0.0000000000000131006316905768 1.31006316905768e-14 """ try: x^6 + 2*x^5 + 4*x^4 + 8*x^3 + 16*x^2 + 32*x + 64 sage: a.minpoly()(a) [-0.00000000000000031918911957973251 .. 0.00000000000000034694469519536142] + [-0.00000000000000033133218391157016 .. 0.00000000000000032786273695961655]*I [-3.1918911957973251e-16 .. 3.4694469519536142e-16] + [-3.3133218391157016e-16 .. 3.2786273695961655e-16]*I sage: a.minpoly()(a) == 0 True
• ## sage/rings/rational.pyx

 r7455 1.29099444873581 sage: (990829038092384908234098239048230984/4).sqrt_approx() 497701978620837137.47374920870362581922510725585130996993055116540856385 4.9770197862083713747374920870362581922510725585130996993055116540856385e17 sage: (5/3).sqrt_approx(prec=200) 1.2909944487358056283930884665941332036109739017638636088625
• ## sage/rings/real_mpfi.pyx

 r7428 1.38777878078144e-17 sage: outward.upper() - nearest.upper() 0.000000000000000111022302462516 1.11022302462516e-16 Some examples with a real interval field of higher precision: 0.666666666666667 sage: RIF(pi).diameter() 0.000000000000000141357985842823 1.41357985842823e-16 sage: RIF(pi).absolute_diameter() 0.000000000000000444089209850063 4.44089209850063e-16 sage: RIF(pi).relative_diameter() 0.000000000000000141357985842823 1.41357985842823e-16 sage: (RIF(pi) - RIF(3, 22/7)).diameter() 0.142857142857144 EXAMPLES: sage: RIF(1.0) << 32 [4294967296.0000000 .. 4294967296.0000000] [4.2949672960000000e9 .. 4.2949672960000000e9] """ if isinstance(x, RealIntervalFieldElement) and isinstance(y, (int,long, Integer)): True sage: r.sqrt()^2 - r [-0.00000000000090949470177292824 .. 0.0000000000018189894035458565] [-9.0949470177292824e-13 .. 1.8189894035458565e-12] sage: r = RIF(-2.0) sage: r = RIF(32.3) sage: a = r.exp(); a [106588847274864.46 .. 106588847274864.49] [1.0658884727486446e14 .. 1.0658884727486449e14] sage: a.log() [32.299999999999990 .. 32.300000000000005] sage: r = RIF(-32.3) sage: r.exp() [0.0000000000000093818445884986834 .. 0.0000000000000093818445884986851] [9.3818445884986834e-15 .. 9.3818445884986851e-15] """ cdef RealIntervalFieldElement x sage: r = RIF(32.0) sage: r.exp2() [4294967296.0000000 .. 4294967296.0000000] [4.2949672960000000e9 .. 4.2949672960000000e9] sage: r = RIF(-32.3) sage: r.exp2() [0.00000000018911724825302069 .. 0.00000000018911724825302073] [1.8911724825302069e-10 .. 1.8911724825302073e-10] """ cdef RealIntervalFieldElement x sage: t=RIF(pi)/2 sage: t.cos() [-0.00000000000000016081226496766367 .. 0.000000000000000061232339957367661] [-1.6081226496766367e-16 .. 6.1232339957367661e-17] sage: t.cos().cos() [0.99999999999999988 .. 1.0000000000000000] False sage: q - q2 [-0.00000000000000044408920985006262 .. 0.00000000000000044408920985006262] [-4.4408920985006262e-16 .. 4.4408920985006262e-16] sage: q in q2 True False sage: q - q2 [-0.00000000000000022204460492503131 .. 0.00000000000000022204460492503131] [-2.2204460492503131e-16 .. 2.2204460492503131e-16] sage: q in q2 True False sage: q - q2 [-0.00000000000000022204460492503131 .. 0.00000000000000022204460492503131] [-2.2204460492503131e-16 .. 2.2204460492503131e-16] sage: q in q2 True [0.46401763049299088 .. 0.46401763049299106] sage: i.asinh() - q [-0.00000000000000016653345369377349 .. 0.00000000000000016653345369377349] [-1.6653345369377349e-16 .. 1.6653345369377349e-16] """ cdef RealIntervalFieldElement x [0.42091124104853488 .. 0.42091124104853501] sage: i.atanh() - q [-0.00000000000000016653345369377349 .. 0.00000000000000016653345369377349] [-1.6653345369377349e-16 .. 1.6653345369377349e-16] """ cdef RealIntervalFieldElement x [1.000000000000000000000000000000000000 .. 1.000000000000000000000000000000000000] sage: RealInterval(29308290382930840239842390482, 3^20) [3486784401.00000000000000000000 .. 29308290382930840239842390482.0] [3.48678440100000000000000000000e9 .. 2.93082903829308402398423904820e28] """ if not isinstance(s, str):
• ## sage/rings/real_mpfr.pyx

 r7470 sage: RR(sys.maxint) 9223372036854780000.     # 64-bit 2147483647.00000         # 32-bit 9.22337203685478e18      # 64-bit 2.14748364700000e9       # 32-bit TESTS: sage: b = 2.0^99 sage: b.str() '633825300114115000000000000000.' '6.33825300114115e29' sage: b.str(no_sci=False) '6.33825300114115e29' sage: b.str(no_sci=True) '633825300114115000000000000000.' '6.33825300114115e29' sage: c = 2.0^100 sage: c.str() '1267650600228230000000000000000.' sage: 0.5^53 0.000000000000000111022302462516 1.11022302462516e-16 sage: 0.5^54 5.55111512312578e-17 t = str(s) mpfr_free_str(s) cdef int digits A big number with no decimal point: sage: a = RR(10^17); a 100000000000000000. 1.00000000000000e17 sage: a.integer_part() 100000000000000000 EXAMPLES: sage: 1.0 << 32 4294967296.00000 4.29496729600000e9 sage: 1.5 << 2.5 Traceback (most recent call last): sage: r = -119.0 sage: r.cube_root()^3 - r       # illustrates precision loss -0.0000000000000142108547152020 -1.42108547152020e-14 """ cdef RealNumber x sage: r = 32.3 sage: a = r.exp(); a 106588847274864. 1.06588847274864e14 sage: a.log() 32.3000000000000 sage: r = -32.3 sage: r.exp() 0.00000000000000938184458849869 9.38184458849869e-15 """ cdef RealNumber x sage: r = 32.0 sage: r.exp2() 4294967296.00000 4.29496729600000e9 sage: r = -32.3 sage: r.exp2() 0.000000000189117248253021 1.89117248253021e-10 """
Note: See TracChangeset for help on using the changeset viewer.