Module: sage.functions.constants
Mathematical constants
The following standard mathematical constants are defined in Sage, along with support for coercing them into GAP, GP/PARI, KASH, Maxima, Mathematica, Maple, Octave, and Singular:
sage: pi pi sage: e # base of the natural logarithm e sage: NaN # Not a number NaN sage: golden_ratio golden_ratio sage: log2 # natural logarithm of the real number 2 log2 sage: euler_gamma # Euler's gamma constant euler_gamma sage: catalan # the Catalon constant catalan sage: khinchin # Khinchin's constant khinchin sage: twinprime twinprime sage: merten merten sage: brun brun
Support for coercion into the various systems means that if, e.g.,
you want to create
in Maxima and Singular, you don't have
to figure out the special notation for each system. You just
type the following:
sage: pi.str() '3.14159265358979' sage: maxima(pi) %pi sage: singular(pi) 3.14159265358979 sage: gap(pi) 3.14159265358979 sage: gp(pi) 3.141592653589793238462643383 # 32-bit 3.1415926535897932384626433832795028842 # 64-bit sage: pari(pi) 3.141592653589793238462643383 # 32-bit 3.1415926535897932384626433832795028842 # 64-bit sage: kash(pi) # optional 3.14159265358979323846264338328 sage: mathematica(pi) # optional Pi sage: maple(pi) # optional Pi sage: octave(pi) # optional 3.14159
Arithmetic operations with constants also yield constants, which can be coerced into other systems or evaluated.
sage: a = pi + e*4/5; a pi + 4*e/5 sage: maxima(a) %pi+4*%e/5 sage: RealField(15)(a) # 15 *bits* of precision 5.316 sage: gp(a) 5.316218116357029426750873360 # 32-bit 5.3162181163570294267508733603616328824 # 64-bit sage: print mathematica(a) # optional 4 E --- + Pi 5
Decimal expansions of constants
We can obtain floating point approximations to each of these constants by coercing into the real field with given precision. For example, to 200 decimal places we have the following:
sage: R = RealField(200); R Real Field with 200 bits of precision
sage: R(pi) 3.1415926535897932384626433832795028841971693993751058209749
sage: R(e) 2.7182818284590452353602874713526624977572470936999595749670
sage: R(NaN) NaN
sage: R(golden_ratio) 1.6180339887498948482045868343656381177203091798057628621354
sage: R(log2) 0.69314718055994530941723212145817656807550013436025525412068
sage: R(euler_gamma) 0.57721566490153286060651209008240243104215933593992359880577
sage: R(catalan) 0.91596559417721901505460351493238411077414937428167213426650
sage: R(khinchin) 2.6854520010653064453097148354817956938203822939944629530512
Arithmetic with constants
sage: f = I*(e+1); f (e + 1)*I sage: f^2 -(e + 1)^2
sage: pp = pi+pi; pp 2*pi sage: R(pp) 6.2831853071795864769252867665590057683943387987502116419499
sage: s = (1 + e^pi); s e^pi + 1 sage: R(s) 24.140692632779269005729086367948547380266106242600211993445 sage: R(s-1) 23.140692632779269005729086367948547380266106242600211993445
sage: l = (1-log2)/(1+log2); l (1 - log(2))/(log(2) + 1) sage: R(l) 0.18123221829928249948761381864650311423330609774776013488056
sage: pim = maxima(pi) sage: maxima.eval('fpprec : 100') '100' sage: pim.bfloat() 3.1415926535897932384626433832795028841971693993751058209749445923078164062 86208998628034825342117068b0
Author Log:
TESTS: Coercion of each constant to the RQDF:
sage: RQDF(e) 2.718281828459045235360287471352662497757247093699959574966967630 sage: RQDF(pi) 3.141592653589793238462643383279502884197169399375105820974944590 sage: RQDF(e) 2.718281828459045235360287471352662497757247093699959574966967630 sage: RQDF(I) Traceback (most recent call last): ... TypeError sage: RQDF(golden_ratio) 1.618033988749894848204586834365638117720309179805762862135448623 sage: RQDF(log2) 0.693147180559945309417232121458176568075500134360255254120680009 sage: RQDF(euler_gamma) 0.577215664901532860606512090082402431042159335939923598805767234 sage: RQDF(catalan) 0.915965594177219015054603514932384110774149374281672134266498119 sage: RQDF(khinchin) 2.685452001065306445309714835481795693820382293994462953051152345 sage: RQDF(twinprime) 0.660161815846869573927812110014555778432623360284733413319448422 sage: RQDF(merten) 0.261497212847642783755426838608695859051566648261199206192064212 sage: RQDF(brun) Traceback (most recent call last): ... NotImplementedError: Brun's constant only available up to 41 bits
Coercing the sum of a bunch of the constants to many different floating point rings:
sage: a = pi + e + golden_ratio + log2 + euler_gamma + catalan + khinchin + twinprime + merten; a twinprime + merten + khinchin + euler_gamma + catalan + log(2) + pi + e + (sqrt(5) + 1)/2 sage: parent(a) Symbolic Ring sage: RQDF(a) 13.27134794019724931009881919957581394087110682000307481783297119 sage: RR(a) 13.2713479401972 sage: RealField(212)(a) 13.2713479401972493100988191995758139408711068200030748178329712 sage: RealField(230)(a) 13.271347940197249310098819199575813940871106820003074817832971189555 sage: CC(a) 13.2713479401972 sage: CDF(a) 13.2713479402 sage: ComplexField(230)(a) 13.271347940197249310098819199575813940871106820003074817832971189555 sage: RDF(a) 13.2713479402
Class: Brun
It is not known to very high precision; calculating the number
using twin primes up to
(Sebah 2002) gives the number
.
sage: float(brun) 1.902160583104 sage: R = RealField(41); R Real Field with 41 bits of precision sage: R(brun) 1.90216058310
self) |
sage: loads(dumps(brun)) brun
Functions: floor
self) |
Return the floor of self.
sage: brun.floor() 1
Special Functions: __float__,
__init__,
_mpfr_,
_real_double_,
_real_rqdf_,
_repr_
self) |
sage: float(brun) 1.902160583104
self, R) |
sage: RealField(53)(brun) Traceback (most recent call last): ... NotImplementedError: Brun's constant only available up to 41 bits sage: RealField(41)(brun) 1.90216058310
self, R) |
sage: RDF(brun) 1.9021605831
self, R) |
sage: RealField(53)(brun) Traceback (most recent call last): ... NotImplementedError: Brun's constant only available up to 41 bits
self, [simplify=True]) |
sage: brun._repr_() 'brun' sage: repr(brun) 'brun'
Class: Catalan
sage: catalan^2 + merten merten + catalan^2
self) |
sage: loads(dumps(catalan)) catalan
Functions: floor
self) |
Return the floor of self.
sage: catalan.floor() 0
Special Functions: __float__,
__init__,
_mpfr_,
_real_double_,
_real_rqdf_,
_repr_
self) |
sage: float(catalan) 0.91596559417721901
self, R) |
sage: RealField(100)(catalan) 0.91596559417721901505460351493 sage: catalan._mpfr_(RealField(100)) 0.91596559417721901505460351493
self, R) |
We coerce to the real double field:
sage: RDF(catalan) 0.915965594177
self, R) |
sage: RQDF(catalan) 0.915965594177219015054603514932384110774149374281672134266498119
self, [simplify=True]) |
sage: repr(catalan) 'catalan' sage: catalan._repr_(catalan) 'catalan'
Class: Constant
self, [conversions=], [parent=Symbolic Ring]) |
Functions: floor,
number_of_arguments,
substitute,
variables
self) |
Returns the floor of self.
sage: pi.floor() 3 sage: e.floor() 2 sage: golden_ratio.floor() 1 sage: log2.floor() 0
self) |
Returns the number of arguments of self. For constants, this is just zero.
sage: type(pi) <class 'sage.functions.constants.Pi'> sage: pi.number_of_arguments() 0 sage: e.number_of_arguments() 0
self) |
Substitute values into self. For constants, this just returns self.
sage: pi.substitute(x=3) pi sage: pi.substitute(3) pi sage: pi.substitute(4, x=4) pi
self) |
Return a list of the variables of self. For constants, this is the empty list.
sage: pi.variables() [] sage: e.variables() []
Special Functions: __abs__,
__call__,
__eq__,
__ge__,
__gt__,
__init__,
__le__,
__lt__,
__ne__,
__pow__,
_add_,
_complex_double_,
_complex_mpfr_field_,
_div_,
_fast_float_,
_has_op,
_interface_is_cached_,
_latex_,
_maxima_,
_mul_,
_neg_,
_real_double_,
_recursive_sub,
_recursive_sub_over_ring,
_ser,
_sub_
self) |
Returns the absolute value of self.
sage: abs(pi) pi
self) |
Call self as a function. Since self is a constant function, this just returns self.
sage: pi(2,3,4) pi sage: pi(pi) pi
self, right) |
sage: solve(pi == 2*x) [x == pi/2] sage: solve(cos(x^2) == pi) [x == -sqrt(arccos(pi)), x == sqrt(arccos(pi))]
self, right) |
sage: type(pi>=3) <class 'sage.calculus.equations.SymbolicEquation'> sage: bool(pi>=3) True
self, right) |
sage: type(pi>3) <class 'sage.calculus.equations.SymbolicEquation'> sage: bool(pi>3) True
self, right) |
sage: pi <= 3 pi <= 3 sage: type(pi<=3) <class 'sage.calculus.equations.SymbolicEquation'> sage: bool(pi<=3) False
self, right) |
sage: pi < 3 pi < 3 sage: type(pi<3) <class 'sage.calculus.equations.SymbolicEquation'> sage: bool(pi<3) False
self, right) |
sage: type(pi != 3) <class 'sage.calculus.equations.SymbolicEquation'> sage: bool(pi != 3) True
self, right) |
sage: a = pi^pi; a pi^pi sage: map(type, a._operands) [<class 'sage.calculus.calculus.SymbolicConstant'>, <class 'sage.calculus.calculus.SymbolicConstant'>]
self, right) |
sage: I + 2 I + 2 sage: a = I+I sage: map(type, a._operands) [<class 'sage.calculus.calculus.SymbolicConstant'>, <class 'sage.calculus.calculus.SymbolicConstant'>]
self, R) |
sage: pi._complex_double_(CDF) 3.14159265359
self, R) |
sage: pi._complex_mpfr_field_(ComplexField(53)) 3.14159265358979 sage: pi._complex_mpfr_field_(ComplexField(200)) 3.1415926535897932384626433832795028841971693993751058209749
self, right) |
sage: a = I / pi; a I/pi sage: map(type, a._operands) [<class 'sage.calculus.calculus.SymbolicConstant'>, <class 'sage.calculus.calculus.SymbolicConstant'>]
self, x) |
Check whether or not self contains the operation x. Since self is a constant, this is always False.
sage: pi._has_op(operator.add) False
self) |
Return False, since coercion of functions to interfaces is not cached.
We do not cache coercions of functions to interfaces, since the precision of the interface may change.
sage: gp(pi) 3.141592653589793238462643383 # 32-bit 3.1415926535897932384626433832795028842 # 64-bit sage: old_prec = gp.set_precision(100) sage: gp(pi) 3.1415926535897932384626433832795028841971693993751058209749445923078164062 86208998628034825342117068 sage: _ = gp.set_precision(old_prec) sage: gp(pi) 3.141592653589793238462643383 # 32-bit 3.1415926535897932384626433832795028842 # 64-bit
self) |
Return the LaTeXrepresentation of self.
sage: catalan._latex_() '\\text{catalan}'
self, [session=None]) |
Returns self as a maxima object.
sage: pi._maxima_() %pi
self, right) |
sage: a = I * pi; a I*pi sage: map(type, a._operands) [<class 'sage.calculus.calculus.SymbolicConstant'>, <class 'sage.calculus.calculus.SymbolicConstant'>]
self) |
Returns the negation of self.
sage: -pi -1*pi sage: -e -1*e
self, R) |
sage: pi._real_double_(RDF) 3.14159265359
self, kwds) |
Recursively substitute values into self. For constants, this just returns self.
sage: pi._recursive_sub({x:3}) pi
self, kwds, ring) |
Recursively substitute values into self over a ring. For constants, this just returns ring(self).
sage: pi._recursive_sub_over_ring({x:3}, RDF) 3.14159265359
self) |
Returns self as an element of SymbolicRing.
sage: s = pi._ser(); s pi sage: type(s) <class 'sage.calculus.calculus.SymbolicConstant'> sage: s.parent() Symbolic Ring
self, right) |
sage: a = I - pi; a I - pi sage: map(type, a._operands) [<class 'sage.calculus.calculus.SymbolicConstant'>, <class 'sage.calculus.calculus.SymbolicConstant'>]
Class: Constant_arith
self, x, y, op) |
Special Functions: __init__
Class: Constant_gen
self, x) |
Special Functions: __call__,
__init__,
__repr__
Class: E
sage: RR(e) 2.71828182845905 sage: R = RealField(200); R Real Field with 200 bits of precision sage: R(e) 2.7182818284590452353602874713526624977572470936999595749670 sage: em = 1 + e^(1-e); em e^(1 - e) + 1 sage: R(em) 1.1793740787340171819619895873183164984596816017589156131574 sage: maxima(e).float() 2.718281828459045 sage: t = mathematica(e) # optional sage: t # optional E sage: float(t) # optional 2.7182818284590451
self) |
sage: bool( e == loads(dumps(e)) ) True
Functions: floor
self) |
Returns the floor of self.
sage: e.floor() 2
Special Functions: __float__,
__init__,
_latex_,
_mpfr_,
_real_double_,
_real_rqdf_,
_repr_
self) |
sage: float(e) 2.7182818284590451 sage: e.__float__() 2.7182818284590451
self) |
sage: e._latex_() 'e' sage: latex(e) e
self, R) |
sage: e._mpfr_(RealField(100)) 2.7182818284590452353602874714
self, R) |
sage: e._real_double_(RDF) 2.71828182846
self, R) |
sage: RQDF = RealQuadDoubleField () sage: RQDF.e() 2.718281828459045235360287471352662497757247093699959574966967630
self, [simplify=True]) |
sage: repr(e) 'e' sage: e._repr_() 'e'
Class: EulerGamma
sage: R = RealField() sage: R(euler_gamma) 0.577215664901533 sage: R = RealField(200); R Real Field with 200 bits of precision sage: R(euler_gamma) 0.57721566490153286060651209008240243104215933593992359880577 sage: eg = euler_gamma + euler_gamma; eg 2*euler_gamma sage: R(eg) 1.1544313298030657212130241801648048620843186718798471976115
self) |
sage: loads(dumps(euler_gamma)) euler_gamma
Functions: floor
self) |
Return the floor of self.
sage: euler_gamma.floor() 0
Special Functions: __init__,
_latex_,
_mpfr_,
_real_double_,
_real_rqdf_,
_repr_
self) |
sage: euler_gamma._latex_() '\gamma' sage: latex(euler_gamma) \gamma
self, R) |
sage: RealField(100)(euler_gamma) 0.57721566490153286060651209008 sage: euler_gamma._mpfr_(RealField(100)) 0.57721566490153286060651209008
self, R) |
sage: RDF(euler_gamma) 0.577215664902
self, R) |
sage: RQDF(euler_gamma) 0.577215664901532860606512090082402431042159335939923598805767234 sage: euler_gamma._real_rqdf_(RQDF) 0.577215664901532860606512090082402431042159335939923598805767234
self, [simplify=True]) |
sage: repr(euler_gamma) 'euler_gamma' sage: euler_gamma._repr_() 'euler_gamma'
Class: GoldenRatio
sage: gr = golden_ratio sage: RR(gr) 1.61803398874989 sage: R = RealField(200) sage: R(gr) 1.6180339887498948482045868343656381177203091798057628621354 sage: grm = maxima(golden_ratio);grm (sqrt(5)+1)/2 sage: grm + grm sqrt(5)+1 sage: float(grm + grm) 3.2360679774997898
self) |
sage: loads(dumps(golden_ratio)) golden_ratio
Functions: minpoly
self, [bits=None], [degree=None], [epsilon=0]) |
sage: golden_ratio.minpoly() x^2 - x - 1
Special Functions: __float__,
__init__,
_algebraic_,
_latex_,
_mpfr_,
_real_double_,
_real_rqdf_,
_repr_
self) |
sage: float(golden_ratio) 1.6180339887498949 sage: golden_ratio.__float__() 1.6180339887498949
self, field) |
sage: golden_ratio._algebraic_(QQbar) [1.6180339887498946 .. 1.6180339887498950] sage: QQbar(golden_ratio) [1.6180339887498946 .. 1.6180339887498950]
self) |
sage: latex(golden_ratio) \phi sage: golden_ratio._latex_() '\phi'
self, R) |
sage: golden_ratio._mpfr_(RealField(100)) 1.6180339887498948482045868344 sage: RealField(100)(golden_ratio) 1.6180339887498948482045868344
self, R) |
sage: RDF(golden_ratio) 1.61803398875
self, R) |
sage: golden_ratio._real_rqdf_(RQDF) 1.618033988749894848204586834365638117720309179805762862135448623 sage: RQDF(golden_ratio) 1.618033988749894848204586834365638117720309179805762862135448623
self, [simplify=True]) |
sage: repr(golden_ratio) 'golden_ratio' sage: golden_ratio._repr_() 'golden_ratio'
Class: I_class
sage: I I sage: I^2 -1 sage: float(I) Traceback (most recent call last): ... TypeError sage: gp(I) I sage: RR(I) Traceback (most recent call last): ... TypeError sage: C = ComplexField(200); C Complex Field with 200 bits of precision sage: C(I) 1.0000000000000000000000000000000000000000000000000000000000*I sage: z = I + I; z 2*I sage: C(z) 2.0000000000000000000000000000000000000000000000000000000000*I sage: maxima(2*I) 2*%i sage: 1e8*I 1.00000000000000e8*I
self) |
sage: bool(I == loads(dumps(I))) True
Functions: floor,
minpoly
self) |
sage: I.floor() Traceback (most recent call last): ... TypeError
self, [bits=None], [degree=None], [epsilon=0]) |
sage: I.minpoly() x^2 + 1
Special Functions: __abs__,
__complex__,
__float__,
__init__,
_algebraic_,
_complex_double_,
_complex_mpfr_field_,
_latex_,
_mathml_,
_mpfr_,
_real_double_,
_real_rqdf_,
_repr_
self) |
sage: abs(I) 1 sage: I.__abs__() 1
self) |
sage: complex(I) 1j
self) |
sage: float(I) Traceback (most recent call last): ... TypeError
self, field) |
sage: QQbar(I) 1*I
self, C) |
sage: I._complex_double_(CDF) 1.0*I
self, R) |
sage: I._complex_mpfr_field_(ComplexField(53)) 1.00000000000000*I
self) |
sage: I._latex_() 'i' sage: latex(I) i
self) |
sage: I._mathml_() '<mi>\&i;</mi>' sage: mathml(I) <mi>\&i;</mi>
self, R) |
sage: I._mpfr_(RealField(53)) Traceback (most recent call last): ... TypeError
self, R) |
sage: I._mpfr_(RealField(53)) Traceback (most recent call last): ... TypeError
self, R) |
sage: I._real_rqdf_(RQDF) Traceback (most recent call last): ... TypeError
self, [simplify=True]) |
sage: repr(I) 'I'
Class: Khinchin
sage: float(khinchin) 2.6854520010653062 sage: khinchin.str(100) '2.6854520010653064453097148355' sage: m = mathematica(khinchin); m # optional Khinchin sage: m.N(200) # optional 2.6854520010653064453097148354817956938203822939944629530511523455572188595 371520028011411749318476979951534659052880900828976777164109630517925334832 5966838185231542133211949962603932852204481940961807 # 32-bit 2.6854520010653064453097148354817956938203822939944629530511523455572188595 371520028011411749318476979951534659052880900828976777164109630517925334832 596683818523154213321194996260393285220448194096181 # 64-bit
self) |
sage: loads(dumps(khinchin)) khinchin
Functions: floor
self) |
Returns the floor of self.
sage: khinchin.floor() 2
Special Functions: __float__,
__init__,
_mpfr_,
_real_double_,
_real_rqdf_,
_repr_
self) |
sage: float(khinchin) 2.6854520010653062
self, R) |
sage: RealField(100)(khinchin) 2.6854520010653064453097148355 sage: RealField(20000)(khinchin) Traceback (most recent call last): ... NotImplementedError: Khinchin's constant only available up to 3005 bits
self, R) |
sage: RDF(khinchin) 2.68545200107
self, R) |
sage: RQDF(khinchin) 2.685452001065306445309714835481795693820382293994462953051152345
self, [simplify=True]) |
sage: repr(khinchin) 'khinchin' sage: khinchin._repr_() 'khinchin'
Class: Log2
sage: log2 log2 sage: float(log2) 0.69314718055994529 sage: RR(log2) 0.693147180559945 sage: R = RealField(200); R Real Field with 200 bits of precision sage: R(log2) 0.69314718055994530941723212145817656807550013436025525412068 sage: l = (1-log2)/(1+log2); l (1 - log(2))/(log(2) + 1) sage: R(l) 0.18123221829928249948761381864650311423330609774776013488056 sage: maxima(log2) log(2) sage: maxima(log2).float() .6931471805599453 sage: gp(log2) 0.6931471805599453094172321215 # 32-bit 0.69314718055994530941723212145817656807 # 64-bit
self) |
sage: loads(dumps(log2)) log2
Functions: floor
self) |
Returns the floor of self.
sage: log2.floor() 0
Special Functions: __float__,
__init__,
_latex_,
_mpfr_,
_real_double_,
_real_rqdf_,
_repr_
self) |
sage: float(log2) 0.69314718055994529 sage: log2.__float__() 0.69314718055994529
self) |
sage: log2._latex_() '\log(2)' sage: latex(log2) \log(2)
self, R) |
sage: RealField(100)(log2) 0.69314718055994530941723212146 sage: log2._mpfr_(RealField(100)) 0.69314718055994530941723212146
self, R) |
sage: RDF(log2) 0.69314718056
self, R) |
sage: RQDF(log2) 0.693147180559945309417232121458176568075500134360255254120680009
self, [simplify=True]) |
sage: repr(log2) 'log2' sage: log2._repr_() 'log2'
Class: Merten
sage: float(merten) 0.26149721284764277 sage: R=RealField(200);R Real Field with 200 bits of precision sage: R(merten) 0.26149721284764278375542683860869585905156664826119920619206
self) |
sage: loads(dumps(merten)) merten
Functions: floor
self) |
Returns the floor of self.
sage: merten.floor() 0
Special Functions: __float__,
__init__,
_mpfr_,
_real_double_,
_real_rqdf_,
_repr_
self) |
sage: float(merten) 0.26149721284764277
self, R) |
sage: RealField(1000)(merten) Traceback (most recent call last): ... NotImplementedError: Merten's constant only available up to 320 bits sage: RealField(320)(merten) 0.2614972128476427837554268386086958590515666482611992061920642139249245108 97368209714142631434247
self, R) |
sage: RDF(merten) 0.261497212848
self, R) |
sage: RQDF(merten) 0.261497212847642783755426838608695859051566648261199206192064212
self, [simplify=True]) |
sage: merten._repr_() 'merten' sage: repr(merten) 'merten'
Class: NotANumber
self) |
sage: loads(dumps(NaN)) NaN
Special Functions: __init__,
_mpfr_,
_real_double_,
_real_rqdf_,
_repr_
self, R) |
sage: NaN._mpfr_(RealField(53)) NaN sage: type(_) <type 'sage.rings.real_mpfr.RealNumber'>
self, R) |
sage: RDF(NaN) nan
self, R) |
sage: RQDF(NaN) 'NaN'
self, [simplify=True]) |
sage: repr(NaN) 'NaN' sage: NaN._repr_() 'NaN'
Class: Pi
sage: pi pi sage: float(pi) 3.1415926535897931 sage: gp(pi) 3.141592653589793238462643383 # 32-bit 3.1415926535897932384626433832795028842 # 64-bit sage: RR(pi) 3.14159265358979 sage: R = RealField(200); R Real Field with 200 bits of precision sage: R(pi) 3.1415926535897932384626433832795028841971693993751058209749 sage: pp = pi+pi; pp 2*pi sage: R(pp) 6.2831853071795864769252867665590057683943387987502116419499 sage: maxima(pi) %pi sage: maxima(pi).float() 3.141592653589793
self) |
sage: bool(pi == loads(dumps(pi))) True
Functions: floor
self) |
Returns the floor of self.
sage: pi.floor() 3
Special Functions: __float__,
__init__,
_latex_,
_mathml_,
_mpfr_,
_real_double_,
_real_rqdf_,
_repr_
self) |
sage: float(pi) 3.1415926535897931
self) |
sage: pi._latex_() '\pi' sage: latex(pi) \pi
self) |
sage: pi._mathml_() '<mi>\π</mi>' sage: mathml(pi) <mi>\π</mi>
self, R) |
sage: pi._mpfr_(RealField(100)) 3.1415926535897932384626433833
self, R) |
sage: pi._real_double_(RDF) 3.14159265359
self, R) |
sage: pi._real_rqdf_(RQDF) 3.141592653589793238462643383279502884197169399375105820974944590
self, [simplify=True]) |
sage: repr(pi) 'pi'
Class: TwinPrime
sage: float(twinprime) 0.66016181584686962 sage: R=RealField(200);R Real Field with 200 bits of precision sage: R(twinprime) 0.66016181584686957392781211001455577843262336028473341331945
self) |
sage: loads(dumps(twinprime)) twinprime
Functions: floor
self) |
Returns the floor of self.
sage: twinprime.floor() 0
Special Functions: __float__,
__init__,
_mpfr_,
_real_double_,
_real_rqdf_,
_repr_
self) |
sage: float(twinprime) 0.66016181584686962
self, R) |
sage: RealField(100)(twinprime) 0.66016181584686957392781211001 sage: RealField(20000)(twinprime) Traceback (most recent call last): ... NotImplementedError: Twin Prime constant only available up to 3011 bits
self, R) |
sage: RDF(twinprime) 0.660161815847
self, R) |
sage: RQDF(twinprime) 0.660161815846869573927812110014555778432623360284733413319448422
self, [simplify=True]) |
sage: repr(twinprime) 'twinprime' sage: twinprime._repr_() 'twinprime'
See About this document... for information on suggesting changes.