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