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.
See Complex#arg.
# File complex.rb, line 60
def arg
Math.atan2!(0, self)
end
See Complex#conjugate (short answer: returns self).
# File complex.rb, line 75
def conjugate
self
end
Returns a Complex number
(0,self).
# File complex.rb, line 38
def im
Complex(0, self)
end
The imaginary part of a complex number, i.e. 0.
# File complex.rb, line 52
def image
0
end
See Complex#polar.
# File complex.rb, line 68
def polar
return abs, arg
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please see Improve the docs, or visit Documenting-ruby.org.