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