In Files

  • complex.rb

Class/Module Index [+]

Quicksearch

Numeric

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.

Public Instance Methods

angle() click to toggle source
Alias for: arg
arg() click to toggle source

See Complex#arg.

 
               # File complex.rb, line 60
def arg
  Math.atan2!(0, self)
end
            
Also aliased as: angle
conj() click to toggle source
Alias for: conjugate
conjugate() click to toggle source

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

 
               # File complex.rb, line 75
def conjugate
  self
end
            
Also aliased as: conj
im() click to toggle source

Returns a Complex number (0,self).

 
               # File complex.rb, line 38
def im
  Complex(0, self)
end
            
imag() click to toggle source
Alias for: image
image() click to toggle source

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

 
               # File complex.rb, line 52
def image
  0
end
            
Also aliased as: imag
polar() click to toggle source

See Complex#polar.

 
               # File complex.rb, line 68
def polar
  return abs, arg
end
            
real() click to toggle source

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

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