るりまサーチ

最速Rubyリファレンスマニュアル検索!
9件ヒット [1-9件を表示] (0.037秒)
トップページ > クラス:Complex[x] > クエリ:arg[x]

関連するキーワード

  1. _builtin
  2. complex

ライブラリ

キーワード

検索結果

Complex#arg -> Float (15156)

複素数の偏角を[-π,π]の範囲で返します。

...例:

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...
...ew(-0.0, -0.0).arg #=> -3.14159265358979...
...

例:

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

[注意] 1.9.2...
...#=> 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 (56)

複素数の偏角を[-π,π]の範囲で返します。

...例:

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...
...ew(-0.0, -0.0).arg #=> -3.14159265358979...
...

例:

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

[注意] 1.9.2...
...#=> 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 (50)

自身の偏角を[-π,π]の範囲で返します。

...

例:

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

[注意] 1.9.2...
...#=> 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#polar -> Array (17)

複素数の極座標表示、すなわち、配列 [self.abs, self.arg] を返します。

...複素数の極座標表示、すなわち、配列 [self.abs, self.arg] を返します。

例:

z = Complex.new(3.0, 4.0)

p z #=> Complex(3.0, 4.0)
p z.polar #=> [5.0, 0.927295218001612]...