関連するキーワード
種類
- インスタンスメソッド (23)
- 特異メソッド (3)
検索結果
先頭5件
-
Complex
# to _ f -> Float (118) -
自身を Float に変換します。
...自身を Float に変換します。
@raise RangeError 虚部が 0 ではない場合に発生します。
例:
Complex(3).to_f # => 3.0
Complex(3.5).to_f # => 3.5
Complex(3, 2).to_f # => RangeError... -
Complex
# abs -> Float (109) -
自身の絶対値を返します。
...値を返します。
以下の計算の結果を Float オブジェクトで返します。
sqrt(self.real ** 2 + self.imag **2)
例:
Complex(1, 2).abs # => 2.23606797749979
Complex(3, 4).abs # => 5.0
Complex('1/2', '1/2').abs # => 0.7071067811865476
@see Complex#abs2... -
Complex
# magnitude -> Float (109) -
自身の絶対値を返します。
...値を返します。
以下の計算の結果を Float オブジェクトで返します。
sqrt(self.real ** 2 + self.imag **2)
例:
Complex(1, 2).abs # => 2.23606797749979
Complex(3, 4).abs # => 5.0
Complex('1/2', '1/2').abs # => 0.7071067811865476
@see Complex#abs2... -
Complex
# abs -> Float (108) -
自分自身の絶対値を返します。
...自身の絶対値を返します。
z = a + b * i
としたとき、絶対値の定義は
sqrt(a*a + b*b)
です。
計算結果としてFloatクラスのオブジェクトが返されることに注意してください。... -
Complex
# angle -> Float (104) -
自身の偏角を[-π,π]の範囲で返します。
...ます。
例:
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。
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
[注意]......#=> 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... -
Complex
# arg -> Float (104) -
自身の偏角を[-π,π]の範囲で返します。
...ます。
例:
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。
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
[注意]......#=> 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... -
Complex
# phase -> Float (104) -
自身の偏角を[-π,π]の範囲で返します。
...ます。
例:
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。
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
[注意]......#=> 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... -
Complex
# angle -> Float (103) -
複素数の偏角を[-π,π]の範囲で返します。
...す。
例:
p Complex.new(0, 1).arg == Math::PI/2 #=> true
p Complex.new(0, -1).arg #=> -1.5707963267949
非正の実軸付近での挙動に注意してください。
以下の例のように虚部が 0.0 と -0.0 では値が変わります。
p Complex.new(-1, 0).arg......p Complex.new(-1, -0).arg #=> 3.14159265358979
p Complex.new(-1, -0.0).arg #=> -3.14159265358979
p Complex.new(0, 0.0).arg #=> 0.0
p Complex.new(0, -0.0).arg #=> -0.0
p Complex.new(-0.0, 0).arg #=> 3.14159265358979
p Complex.n... -
Complex
# arg -> Float (103) -
複素数の偏角を[-π,π]の範囲で返します。
...す。
例:
p Complex.new(0, 1).arg == Math::PI/2 #=> true
p Complex.new(0, -1).arg #=> -1.5707963267949
非正の実軸付近での挙動に注意してください。
以下の例のように虚部が 0.0 と -0.0 では値が変わります。
p Complex.new(-1, 0).arg......p Complex.new(-1, -0).arg #=> 3.14159265358979
p Complex.new(-1, -0.0).arg #=> -3.14159265358979
p Complex.new(0, 0.0).arg #=> 0.0
p Complex.new(0, -0.0).arg #=> -0.0
p Complex.new(-0.0, 0).arg #=> 3.14159265358979
p Complex.n... -
Complex
# imag -> Float (103) -
虚部を返します。
虚部を返します。 -
Complex
# image -> Float (103) -
虚部を返します。
虚部を返します。 -
Complex
# abs2 -> Float (102) -
自分自身の絶対値の2乗を返します。
...自分自身の絶対値の2乗を返します。
z = a + b * i
としたとき、Complex#abs2 の定義は
a*a + b*b
です。... -
Complex
# real -> Float (102) -
実部を返します。
実部を返します。 -
Complex
. generic?(other) -> bool (23) -
other が Integer Float Rational クラスのオブジェクトかどうか判定します。
...other が Integer Float Rational クラスのオブジェクトかどうか判定します。
@param other 判定対象のオブジェクト
@return Integer Float Rational クラスのオブジェクトの時 true
それ以外の場合には false を返します。......other が Integer Float Rational クラスのオブジェクト
かどうか判定します。
@param other 判定対象のオブジェクト
@return Integer Float Rational クラスのオブジェクトの
時 trueそれ以外の場合には false を返します。... -
Complex
# imag -> Fixnum (3) -
虚部を返します。
虚部を返します。 -
Complex
# image -> Fixnum (3) -
虚部を返します。
虚部を返します。 -
Complex
# abs2 -> Fixnum (2) -
自分自身の絶対値の2乗を返します。
...自分自身の絶対値の2乗を返します。
z = a + b * i
としたとき、Complex#abs2 の定義は
a*a + b*b
です。... -
Complex
# real -> Fixnum (2) -
実部を返します。
実部を返します。
