next | previous | forward | backward | up | top | index | toc | home

CC -- the class of all complex numbers

Description

In Macaulay 2, complex numbers are represented as floating point numbers, and so are only approximate. The symbol ii represents the square root of -1.

i1 : z = 3-4*ii

o1 = 3. - 4.ii

o1 : CC
i2 : z^5

o2 = - 237. + 3116.ii

o2 : CC
i3 : 1/z

o3 = 0.12 + 0.16ii

o3 : CC
Arithmetic involving ZZ, QQ, RR, and CC works as one might expect.
i4 : 3 + ii

o4 = 3. + 1.ii

o4 : CC
i5 : 4/5 + 12*ii

o5 = 0.8 + 12.ii

o5 : CC
i6 : 3 == 3 + 0*ii

o6 = true
i7 : (2-ii)^5

o7 = - 38. - 41.ii

o7 : CC
i8 : (1+ii)/3

o8 = 0.333333 + 0.333333ii

o8 : CC

Caveat

Strictly speaking, CC is not a ring, since floating point approximations are used. Consequently, functions which rely on Groebner bases are notoriously unreliable with rings such as RR or CC.

Functions and methods returning a complex number :

Methods that use a complex number :

Fixed objects of class CC :

For the programmer

The object CC is a ring, with ancestor classes Number < Thing.