2009-06-20 01:57:51 +04:00
|
|
|
# :enddoc:
|
|
|
|
|
2009-08-16 19:34:35 +04:00
|
|
|
warn('lib/complex.rb is deprecated') if $VERBOSE
|
2009-08-16 19:18:58 +04:00
|
|
|
|
2008-04-05 18:25:40 +04:00
|
|
|
require 'cmath'
|
|
|
|
|
2008-09-19 17:55:52 +04:00
|
|
|
unless defined?(Math.exp!)
|
|
|
|
Object.instance_eval{remove_const :Math}
|
|
|
|
Math = CMath
|
|
|
|
end
|
2008-08-22 16:27:54 +04:00
|
|
|
|
|
|
|
def Complex.generic? (other)
|
|
|
|
other.kind_of?(Integer) ||
|
|
|
|
other.kind_of?(Float) ||
|
|
|
|
other.kind_of?(Rational)
|
|
|
|
end
|
2008-09-21 02:49:56 +04:00
|
|
|
|
|
|
|
class Complex
|
|
|
|
|
|
|
|
alias image imag
|
|
|
|
|
|
|
|
end
|
2008-09-21 02:55:59 +04:00
|
|
|
|
|
|
|
class Numeric
|
|
|
|
|
|
|
|
def im() Complex(0, self) end
|
|
|
|
|
|
|
|
end
|