Class: Numeric

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

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

conjugate()

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

[Source]

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

im()

Returns a Complex number `(0,self)`.

[Source]

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

imag()

Alias for image

image()

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

[Source]

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

polar()

See Complex#polar.

[Source]

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

real()

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

[Source]

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

[Validate]