Class Numeric
In: complex.rb
Parent: Object

Numeric is a built-in class on which Fixnum, Bignum, etc., are based. Here some methods are added so that all number types can be treated to some extent as Complex numbers.

Methods

angle   arg   conj   conjugate   im   imag   image   polar   real  

Public Instance methods

angle()

Alias for arg

See Complex#arg.

[Source]

# File complex.rb, line 60
  def arg
    if self >= 0
      return 0
    else
      return Math::PI
    end
  end
conj()

Alias for conjugate

See Complex#conjugate (short answer: returns self).

[Source]

# File complex.rb, line 79
  def conjugate
    self
  end

Returns a Complex number (0,self).

[Source]

# File complex.rb, line 38
  def im
    Complex(0, self)
  end
imag()

Alias for image

The imaginary part of a complex number, i.e. 0.

[Source]

# File complex.rb, line 52
  def image
    0
  end

See Complex#polar.

[Source]

# File complex.rb, line 72
  def polar
    return abs, arg
  end

The real part of a complex number, i.e. self.

[Source]

# File complex.rb, line 45
  def real
    self
  end

[Validate]