Back: Complex package Up: Complex package Forward: Complex class-instance creation   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

2.1 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.

2.1.1 Complex class: instance creation  (class)
2.1.2 Complex: comparing  (instance)
2.1.3 Complex: converting  (instance)
2.1.4 Complex: creation/coercion  (instance)
2.1.5 Complex: math  (instance)
2.1.6 Complex: printing  (instance)
2.1.7 Complex: testing  (instance)
2.1.8 Complex: transcendental functions  (instance)


2.1.1 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.


2.1.2 Complex: comparing

< aNumber
Not commented.

<= aNumber
Not commented.

= aNumber
Not commented.

> aNumber
Not commented.

>= aNumber
Not commented.

hash
Not commented.

~= aNumber
Not commented.


2.1.3 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.


2.1.4 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'.


2.1.5 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.


2.1.6 Complex: printing

printOn: aStream
Not commented.

storeOn: aStream
Not commented.


2.1.7 Complex: testing

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


2.1.8 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.



Back: Complex-testing Up: Complex Forward: DBI package   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on April, 16 2013 using texi2html