inspect

cmp.inspect â string Instance Public methods Returns the value as a string for inspection. Complex(2).inspect #=> "(2+0i)" Complex('-8/6').inspect #=> "((-4/3)+0i)" Complex('1/2i').inspect #=> "(0+(1/2)*i)" Complex(0, Float::INFINITY).inspect #=> "(0+Infinity*i)" Complex(Float::NAN, Float::NAN).inspect #=> "(NaN+NaN*i)"

imaginary

cmp.imaginary â real Instance Public methods Returns the imaginary part. Complex(7).imaginary #=> 0 Complex(9, -4).imaginary #=> -4

imag

cmp.imag â realcmp.imaginary â real Instance Public methods Returns the imaginary part. Complex(7).imaginary #=> 0 Complex(9, -4).imaginary #=> -4

fdiv

cmp.fdiv(numeric) â complex Instance Public methods Performs division as each part is a float, never returns a float. Complex(11, 22).fdiv(3) #=> (3.6666666666666665+7.333333333333333i)

denominator

cmp.denominator â integer Instance Public methods Returns the denominator (lcm of both denominator - real and imag). See numerator.

conjugate

cmp.conjugate â complex Instance Public methods Returns the complex conjugate. Complex(1, 2).conjugate #=> (1-2i)

conj

cmp.conj â complexcmp.conjugate â complex Instance Public methods Returns the complex conjugate. Complex(1, 2).conjugate #=> (1-2i)

as_json

as_json(*) Instance Public methods

arg

cmp.arg â float Instance Public methods Returns the angle part of its polar form. Complex.polar(3, Math::PI/2).arg #=> 1.5707963267948966

angle

cmp.angle â float Instance Public methods Returns the angle part of its polar form. Complex.polar(3, Math::PI/2).arg #=> 1.5707963267948966