Top Level Namespace
Defined Under Namespace
Modules: Math Classes: Complex, Numeric
Instance Method Summary collapse
-
#Complex(a, b = 0) ⇒ Object
Creates a Complex number.
Instance Method Details
#Complex(a, b = 0) ⇒ Object
Creates a Complex number. a
and b
should be Numeric. The result will be a+bi
.
92 93 94 95 96 97 98 |
# File 'lib/complex.rb', line 92 def Complex(a, b = 0) if b == 0 and (a.kind_of?(Complex) or defined? Complex::Unify) a else Complex.new( a.real-b.imag, a.imag+b.real ) end end |