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
  • 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

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 * CCi -- see * -- a binary operator, usually used for multiplication
  • CC * RRi -- see * -- a binary operator, usually used for multiplication
  • CCi * CC -- see * -- a binary operator, usually used for multiplication
  • RRi * CC -- see * -- a binary operator, usually used for multiplication
  • CC + CCi -- see + -- a unary or binary operator, usually used for addition
  • CC + InfiniteNumber -- see + -- a unary or binary operator, usually used for addition
  • CC + RRi -- see + -- a unary or binary operator, usually used for addition
  • CCi + CC -- see + -- a unary or binary operator, usually used for addition
  • InfiniteNumber + CC -- see + -- a unary or binary operator, usually used for addition
  • RRi + CC -- see + -- a unary or binary operator, usually used for addition
  • CC - CCi -- see - -- a unary or binary operator, usually used for negation or subtraction
  • CC - InfiniteNumber -- see - -- a unary or binary operator, usually used for negation or subtraction
  • CC - RRi -- see - -- a unary or binary operator, usually used for negation or subtraction
  • CCi - CC -- 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
  • RRi - CC -- see - -- a unary or binary operator, usually used for negation or subtraction
  • CC / CCi -- see / -- a binary operator, usually used for division
  • CC / RRi -- see / -- a binary operator, usually used for division
  • CCi / CC -- see / -- a binary operator, usually used for division
  • RRi / CC -- see / -- a binary operator, usually used for division
  • 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
  • conjugate(CC) -- see conjugate -- complex conjugate
  • format(CC) -- see format -- format a string or real number
  • interval(CC) -- see interval -- construct an interval
  • interval(CC,CC) -- see interval -- construct an interval
  • interval(CC,RR) -- see interval -- construct an interval
  • interval(CC,RRi) -- see interval -- construct an interval
  • interval(RR,CC) -- see interval -- construct an interval
  • interval(RRi,CC) -- see interval -- construct an interval
  • isMember(CC,CCi) -- see isMember(QQ,CCi) -- membership test in an interval
  • isMember(CC,RRi) -- see isMember(QQ,CCi) -- membership test in an interval
  • isReal(CC) -- see isReal -- whether a number is real
  • CC << ZZ -- see left shift
  • lift(CC,type of CC_*) -- see lift -- lift to another ring
  • 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 RRi_*) -- 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 /build/reproducible-path/macaulay2-1.26.05+ds/M2/Macaulay2/packages/Macaulay2Doc/ov_rings.m2:362:0.