Class

Complex

Extends:

The complex number class. See complex.rb for an overview.

Constants
I I is the imaginary number. It exists at point (0,1) on the complex plane.
Unify
Aliases
imag
Public Attributes
image The imaginary part of a complex number.
real The real part of a complex number.
Public Methods
% Remainder after division by a real or complex number.
* Multiplication with real or complex number.
** Raise this complex number to the given (real or complex) power.
+ Addition with real or complex number.
- Subtraction with real or complex number.
/ Division by real or complex number.
<=> Compares the absolute values of the two numbers.
== Test for numerical equality (a == a + 0i).
abs Absolute value (aka modulus): distance from the zero point on the complex plane.
abs2 Square of the absolute value.
angle Alias for #arg
arg Argument (angle from (1,0) on the complex plane).
coerce Attempts to coerce other to a Complex number.
conj Alias for #conjugate
conjugate Complex conjugate (z + z.conjugate = 2 * z.real).
denominator FIXME
generic?
hash Returns a hash code for the complex number.
inspect Returns "Complex(real, image)".
new
new! Creates a Complex number a+bi.
numerator FIXME
polar Creates a Complex number in terms of r (radius) and theta (angle).
polar Returns the absolute value and the argument.
to_s Standard string representation of the complex number.
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.