Macaulay2 » Documentation
Packages » Macaulay2Doc » rings » basic rings of numbers » CC
next | previous | forward | backward | up | index | toc

CC -- the class of all complex numbers

Description

In Macaulay2, complex numbers are represented as floating point numbers, and so are only approximate. The symbol ii represents the square root of -1 in many numeric contexts. A complex number is obtained by using the symbolic constant ii or the conversion functions toCC and numeric, in combination with real numbers (see RR). It is stored internally as a pair of arbitrary precision floating point real numbers, using the MPFR library.
i1 : z = 3-4*ii

o1 = 3-4*ii

o1 : CC (of precision 53)
i2 : z^5

o2 = -237.0000000000017+3115.999999999999*ii

o2 : CC (of precision 53)
i3 : 1/z

o3 = .12+.16*ii

o3 : CC (of precision 53)
i4 : +ii

o4 = ii

o4 : CC (of precision 53)
i5 : numeric_200 ii

o5 = ii

o5 : CC (of precision 200)
Complex numbers are ordered lexicographically, mingled with real numbers.
i6 : sort {1+ii,2+ii,1-ii,2-ii,1/2,2.1,7/5}

      1              7
o6 = {-, 1-ii, 1+ii, -, 2-ii, 2+ii, 2.1}
      2              5

o6 : List
The precision is measured in bits, is visible in the ring displayed on the second of each pair of output lines, and can be recovered using precision.
i7 : precision z

o7 = 53
For complex numbers, the functions class and ring yield different results. That allows numbers of various precisions to be used without creating a new ring for each precision.
i8 : class z

o8 = CC

o8 : InexactFieldFamily
i9 : ring z

o9 = CC
       53

o9 : ComplexField
A computation involving numbers of different precisions has a result with the minimal precision occurring. Numbers that appear alone on an output line are displayed with all their meaningful digits. (Specifying 100 bits of precision yields about 30 decimal digits of precision.)
i10 : 3p100+2p90e3*ii

o10 = 3+2000*ii

o10 : CC (of precision 90)
Numbers displayed inside more complicated objects are printed with the number of digits specified by printingPrecision.
i11 : printingPrecision

o11 = 6
i12 : x = {1/3.*ii,1/3p100*ii}

o12 = {.333333*ii, .333333*ii}

o12 : List
Use toExternalString to produce something that, when encountered as input, will reproduce exactly what you had before.
i13 : y = toExternalString x

o13 = {toCC(.0p53,.33333333333333331p53),toCC(.0p100
      ,.33333333333333333333333333333346p100)}
i14 : value y === x

o14 = true

Caveat

Currently, most transcendental functions are not implemented for complex arguments.

See also

Menu

Functions and methods returning a complex number:

  • CC * CC -- see * -- a binary operator, usually used for multiplication
  • CC * QQ -- see * -- a binary operator, usually used for multiplication
  • CC * RR -- see * -- a binary operator, usually used for multiplication
  • CC * ZZ -- see * -- a binary operator, usually used for multiplication
  • QQ * CC -- see * -- a binary operator, usually used for multiplication
  • RR * CC -- see * -- a binary operator, usually used for multiplication
  • ZZ * CC -- see * -- a binary operator, usually used for multiplication
  • + CC -- see + -- a unary or binary operator, usually used for addition
  • CC + CC -- see + -- a unary or binary operator, usually used for addition
  • CC + QQ -- see + -- a unary or binary operator, usually used for addition
  • CC + RR -- see + -- a unary or binary operator, usually used for addition
  • CC + ZZ -- see + -- a unary or binary operator, usually used for addition
  • QQ + CC -- see + -- a unary or binary operator, usually used for addition
  • RR + CC -- see + -- a unary or binary operator, usually used for addition
  • ZZ + CC -- see + -- a unary or binary operator, usually used for addition
  • - CC -- see - -- a unary or binary operator, usually used for negation or subtraction
  • CC - CC -- see - -- a unary or binary operator, usually used for negation or subtraction
  • CC - QQ -- see - -- a unary or binary operator, usually used for negation or subtraction
  • CC - RR -- see - -- a unary or binary operator, usually used for negation or subtraction
  • CC - ZZ -- see - -- a unary or binary operator, usually used for negation or subtraction
  • QQ - CC -- see - -- a unary or binary operator, usually used for negation or subtraction
  • RR - CC -- see - -- a unary or binary operator, usually used for negation or subtraction
  • ZZ - CC -- see - -- a unary or binary operator, usually used for negation or subtraction
  • CC / CC -- see / -- a binary operator, usually used for division
  • CC / QQ -- see / -- a binary operator, usually used for division
  • CC / RR -- see / -- a binary operator, usually used for division
  • CC / ZZ -- see / -- a binary operator, usually used for division
  • QQ / CC -- see / -- a binary operator, usually used for division
  • RR / CC -- see / -- a binary operator, usually used for division
  • ZZ / CC -- see / -- a binary operator, usually used for division
  • acos(CC) -- see acos -- arccosine
  • agm(CC,CC) -- see agm -- arithmetic-geometric mean
  • agm(CC,RR) -- see agm -- arithmetic-geometric mean
  • agm(RR,CC) -- see agm -- arithmetic-geometric mean
  • asin(CC) -- see asin -- arcsine
  • atan(CC) -- see atan -- compute the arctangent of a number
  • Beta(CC,CC) -- see Beta -- Beta function
  • Beta(CC,RR) -- see Beta -- Beta function
  • Beta(RR,CC) -- see Beta -- Beta function
  • cos(CC) -- see cos -- compute the cosine
  • cosh(CC) -- see cosh -- compute the hyperbolic cosine
  • cot(CC) -- see cot -- cotangent
  • coth(CC) -- see coth -- hyperbolic cotangent
  • csc(CC) -- see csc -- cosecant
  • csch(CC) -- see csch -- hyperbolic cosecant
  • Digamma(CC) -- see Digamma -- Digamma function
  • eint(CC) -- see eint -- exponential integral
  • erf(CC) -- see erf -- error function
  • erfc(CC) -- see erfc -- complementary error function
  • exp(CC) -- see exp -- exponential function
  • expm1(CC) -- see expm1 -- exponential minus 1
  • Gamma(CC) -- see Gamma -- Gamma function
  • Gamma(CC,CC) -- see Gamma -- Gamma function
  • Gamma(CC,RR) -- see Gamma -- Gamma function
  • Gamma(RR,CC) -- see Gamma -- Gamma function
  • log(CC) -- see log -- logarithm function
  • log(RR,CC) -- see log -- logarithm function
  • log(RR,RR) -- see log -- logarithm function
  • log1p(CC) -- see log1p -- logarithm of 1+x
  • regularizedBeta(CC,CC,CC) -- see regularizedBeta -- regularized beta function
  • regularizedBeta(CC,CC,RR) -- see regularizedBeta -- regularized beta function
  • regularizedBeta(CC,RR,CC) -- see regularizedBeta -- regularized beta function
  • regularizedBeta(CC,RR,RR) -- see regularizedBeta -- regularized beta function
  • regularizedBeta(RR,CC,CC) -- see regularizedBeta -- regularized beta function
  • regularizedBeta(RR,CC,RR) -- see regularizedBeta -- regularized beta function
  • regularizedBeta(RR,RR,CC) -- see regularizedBeta -- regularized beta function
  • regularizedGamma(CC,CC) -- see regularizedGamma -- upper regularized gamma function
  • regularizedGamma(CC,RR) -- see regularizedGamma -- upper regularized gamma function
  • regularizedGamma(RR,CC) -- see regularizedGamma -- upper regularized gamma function
  • sec(CC) -- see sec -- secant
  • sech(CC) -- see sech -- hyperbolic secant
  • sin(CC) -- see sin -- compute the sine
  • sinh(CC) -- see sinh -- compute the hyperbolic sine
  • sqrt(CC) -- see sqrt -- square root function
  • sqrt(RR) -- see sqrt -- square root function
  • tan(CC) -- see tan -- compute the tangent
  • tanh(CC) -- see tanh -- compute the hyperbolic tangent
  • toCC(CC) -- see toCC -- convert to high-precision complex number
  • toCC(QQ) -- see toCC -- convert to high-precision complex number
  • toCC(RR) -- see toCC -- convert to high-precision complex number
  • toCC(RR,RR) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,CC) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,QQ) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,QQ,QQ) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,QQ,RR) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,QQ,ZZ) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,RR) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,RR,QQ) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,RR,RR) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,RR,ZZ) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,ZZ) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,ZZ,QQ) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,ZZ,RR) -- see toCC -- convert to high-precision complex number
  • toCC(ZZ,ZZ,ZZ) -- see toCC -- convert to high-precision complex number
  • zeta(CC) -- see zeta -- Riemann zeta function

Methods that use a complex number:

  • CC % CC -- see % -- a binary operator, usually used for remainder and reduction
  • CC % QQ -- see % -- a binary operator, usually used for remainder and reduction
  • CC % RR -- see % -- a binary operator, usually used for remainder and reduction
  • CC % ZZ -- see % -- a binary operator, usually used for remainder and reduction
  • CC + InfiniteNumber -- see + -- a unary or binary operator, usually used for addition
  • InfiniteNumber + CC -- see + -- a unary or binary operator, usually used for addition
  • CC - InfiniteNumber -- see - -- a unary or binary operator, usually used for negation or subtraction
  • InfiniteNumber - CC -- see - -- a unary or binary operator, usually used for negation or subtraction
  • CC // CC -- see // -- a binary operator, usually used for quotient
  • CC // QQ -- see // -- a binary operator, usually used for quotient
  • CC // RR -- see // -- a binary operator, usually used for quotient
  • CC // ZZ -- see // -- a binary operator, usually used for quotient
  • abs(CC) -- see abs -- absolute value function
  • conjugate(CC) -- see conjugate -- complex conjugate
  • format(CC) -- see format -- format a string or real number
  • isReal(CC) -- see isReal -- whether a number is real
  • CC << ZZ -- see left shift
  • lift(CC,type of QQ) -- see lift -- lift to another ring
  • lift(CC,type of RR_*) -- see lift -- lift to another ring
  • lift(CC,type of ZZ) -- see lift -- lift to another ring
  • lngamma(CC) -- see lngamma -- logarithm of the Gamma function
  • numeric(CC) -- see numeric -- convert to floating point
  • numeric(ZZ,CC) -- see numeric -- convert to floating point
  • CC >> ZZ -- see right shift
  • ring(CC) -- see ring -- get the associated ring of an object
  • round(ZZ,CC) -- see round -- round a number
  • size2(CC) -- see size2 -- number of binary digits to the left of the point

For the programmer

The object CC is an inexact field family, with ancestor classes InexactNumber < Number < Thing.


The source of this document is in Macaulay2Doc/ov_rings.m2:360:0.