Alphabetic list: * Complex::

Class tree:
  (Object) (Magnitude) (Number) * Complex::

Complex
=======

Defined in namespace Smalltalk
Superclass: Number
Category: Examples-Useful
     I provide complex numbers, with full interoperability with other kinds of numbers.  Complex numbers can be created from imaginary numbers, which in turn are created with `Complex i' or the #i method (e.g. `3 i').  Alternatively, they can be created from polar numbers.

Complex class: instance creation
--------------------------------

i
     Return the imaginary unit, -1 sqrt.

initialize
     Initialize some common complex numbers.

new
     This method should not be called for instances of this class.

real: re imaginary: im
     Return a complex number with the given real and imaginary parts.

realResult: re imaginary: im
     Private - Return a new complex number knowing that re and im have the same generality.

rho: dist theta: angle
     Return a complex number whose absolute value is dist and whose argument is angle.

Complex: comparing
------------------

< aNumber
     Not commented.

<= aNumber
     Not commented.

= aNumber
     Not commented.

> aNumber
     Not commented.

>= aNumber
     Not commented.

hash
     Not commented.

~= aNumber
     Not commented.

Complex: converting
-------------------

asExactFraction
     Not commented.

asFloat
     Not commented.

asFloatD
     Not commented.

asFloatE
     Not commented.

asFloatQ
     Not commented.

asFraction
     Not commented.

ceiling
     Not commented.

floor
     Not commented.

rounded
     Not commented.

truncated
     Not commented.

Complex: creation/coercion
--------------------------

coerce: aNumber
     Not commented.

generality
     Not commented.

i
     Return the receiver multiplied by the imaginary unit.

imaginary
     Answer `im'.

isComplex
     Answer `true'.

one
     Answer `One'.

real
     Answer `re'.

setReal: real imaginary: imag
     Not commented.

zero
     Answer `Zero'.

Complex: math
-------------

* z
     Multiply the receiver by the (real or complex) number z.

+ z
     Sum the receiver with the (real or complex) number z.

- z
     Subtract the (real or complex) number z from the receiver.

/ z
     Divide the receiver by the (real or complex) number z.

abs
     Return the absolute value of the receiver.

absSquared
     Return the squared absolute value of the receiver.

conjugate
     Return the complex conjugate of the receiver.

reciprocal
     Return the reciprocal of the receiver.

Complex: printing
-----------------

printOn: aStream
     Not commented.

storeOn: aStream
     Not commented.

Complex: testing
----------------

isExact
     Answer whether the receiver performs exact arithmetic.  Complex numbers do so as long as both parts, real and imaginary, are exact.

Complex: transcendental functions
---------------------------------

arcTan
     Return the arc-tangent of the receiver.

arcTan: aNumber
     Return the arc-tangent of aNumber divided by the receiver.

arg
     Return the argument of the receiver.

cos
     Return the cosine of the receiver.

cosh
     Return the hyperbolic cosine of the receiver.

exp
     Return e raised to the receiver.

ln
     Return the natural logarithm of the receiver.

log
     Return the base-10 logarithm of the receiver.

sin
     Return the sine of the receiver.

sinh
     Return the hyperbolic sine of the receiver.

sqrt
     Return the square root of the receiver.  Can be improved!

tan
     Return the tangent of the receiver.

tanh
     Return the hyperbolic tangent of the receiver.