種類
- インスタンスメソッド (540)
- 特異メソッド (48)
- 定数 (12)
ライブラリ
- ビルトイン (576)
-
json
/ add / complex (24)
キーワード
- * (12)
- ** (12)
- + (12)
- - (12)
- -@ (12)
-
/ (12) - < (12)
- <= (12)
- <=> (6)
- == (12)
- > (12)
- >= (12)
- I (12)
- abs (12)
- abs2 (12)
- angle (12)
- arg (12)
- between? (12)
- clamp (12)
- coerce (12)
- conj (12)
- conjugate (12)
- denominator (12)
- fdiv (12)
- finite? (9)
- imag (12)
- imaginary (12)
- infinite? (9)
- inspect (12)
-
json
_ create (12) - magnitude (12)
-
marshal
_ dump (12) - numerator (12)
- phase (12)
- polar (24)
- quo (12)
- rationalize (24)
- real (12)
- real? (12)
- rect (24)
- rectangular (24)
-
to
_ c (12) -
to
_ f (12) -
to
_ i (12) -
to
_ json (12) -
to
_ r (12) -
to
_ s (12)
検索結果
先頭5件
-
Complex
# <=>(other) -> -1 | 0 | 1 | nil (1.0) -
self の虚部がゼロで other が実数の場合、 self の実部の <=> メソッドで other と比較した結果を返します。 other が Complex で虚部がゼロの場合も同様です。
...が Complex で虚部がゼロの場合も同様です。
その他の場合は nil を返します。
@param other 自身と比較する数値
//emlist[例][ruby]{
Complex(2, 3) <=> Complex(2, 3) #=> nil
Complex(2, 3) <=> 1 #=> nil
Complex(2) <=> 1 #=> 1
Complex(2)......<=> 2 #=> 0
Complex(2) <=> 3 #=> -1
//}... -
Complex
# ==(other) -> bool (1.0) -
数値として等しいか判定します。
...数値として等しいか判定します。
@param other 自身と比較する数値
//emlist[例][ruby]{
Complex(2, 1) == Complex(1) # => false
Complex(1, 0) == Complex(1) # => true
Complex(1, 0) == 1 # => true
//}... -
Complex
# >(other) -> bool (1.0) -
@undef
@undef -
Complex
# >=(other) -> bool (1.0) -
@undef
@undef -
Complex
# abs -> Numeric (1.0) -
自身の絶対値を返します。
...す。
以下の計算の結果を Float オブジェクトで返します。
sqrt(self.real ** 2 + self.imag ** 2)
//emlist[例][ruby]{
Complex(1, 2).abs # => 2.23606797749979
Complex(3, 4).abs # => 5.0
Complex('1/2', '1/2').abs # => 0.7071067811865476
//}
@see Complex#abs2... -
Complex
# abs2 -> Numeric (1.0) -
自身の絶対値の 2 乗を返します。
...自身の絶対値の 2 乗を返します。
以下の計算の結果を返します。
self.real ** 2 + self.imag ** 2
//emlist[例][ruby]{
Complex(1, 1).abs2 # => 2
Complex(1.0, 1.0).abs2 # => 2.0
Complex('1/2', '1/2').abs2 # => (1/2)
//}
@see Complex#abs... -
Complex
# angle -> Float (1.0) -
自身の偏角を[-π,π]の範囲で返します。
...ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}
非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。
//emlist[例][ruby]{
Complex(-1, 0).arg #=> 3.141592653589793
Complex(-1, -......0).arg #=> 3.141592653589793
Complex(-1, -0.0).arg #=> -3.141592653589793
Complex(0, 0.0).arg #=> 0.0
Complex(0, -0.0).arg #=> -0.0
Complex(-0.0, 0).arg #=> 3.141592653589793
Complex(-0.0, -0.0).arg #=> -3.141592653589793
//}
@see... -
Complex
# arg -> Float (1.0) -
自身の偏角を[-π,π]の範囲で返します。
...ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}
非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。
//emlist[例][ruby]{
Complex(-1, 0).arg #=> 3.141592653589793
Complex(-1, -......0).arg #=> 3.141592653589793
Complex(-1, -0.0).arg #=> -3.141592653589793
Complex(0, 0.0).arg #=> 0.0
Complex(0, -0.0).arg #=> -0.0
Complex(-0.0, 0).arg #=> 3.141592653589793
Complex(-0.0, -0.0).arg #=> -3.141592653589793
//}
@see... -
Complex
# between?(min , max) -> bool (1.0) -
@undef
@undef -
Complex
# clamp(range) -> object (1.0) -
@undef
@undef