Class Complex
In: lib/complex.rb
Parent: Numeric

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

Methods

%   *   **   +   -   /   <=>   ==   abs   abs2   angle   arg   coerce   conj   conjugate   denominator   hash   inspect   new   new!   numerator   polar   polar   to_s  

Constants

I = Complex(0,1)   I is the imaginary number. It exists at point (0,1) on the complex plane.

External Aliases

image -> imag

Attributes

image  [R]  The imaginary part of a complex number.
real  [R]  The real part of a complex number.

Public Class methods

Creates a Complex number a+bi.

Creates a Complex number in terms of r (radius) and theta (angle).

Public Instance 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).

Absolute value (aka modulus): distance from the zero point on the complex plane.

Square of the absolute value.

angle()

Alias for arg

Argument (angle from (1,0) on the complex plane).

Attempts to coerce other to a Complex number.

conj()

Alias for conjugate

Complex conjugate (z + z.conjugate = 2 * z.real).

Returns a hash code for the complex number.

Returns "Complex(real, image)".

Returns the absolute value and the argument.

Standard string representation of the complex number.

To view or add comments on this documentation, please go to the API wiki.

[Validate]