るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

Complex#-(other) -> Complex (18113.0)

差を計算します。

...差を計算します。

@param other 自身から引く数

//emlist[例][ruby]{
Complex
(1, 2) - Complex(2, 3) # => (-1-1i)
//}...

Complex#-@ -> Complex (6119.0)

自身の符号を反転させたものを返します。

...自身の符号を反転させたものを返します。

//emlist[例][ruby]{
-
Complex(1) # => (-1+0i)
-
Complex(-1, 1) # => (1-1i)
//}...

Complex#angle -> Float (149.0)

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

...を[-π,π]の範囲で返します。

//emlist[例][ruby]{
Complex
.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}

非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-
0.0 では値が変わります。

//emlist[例][ruby]{
Complex
(-1, 0)...
...3589793
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.14159...

Complex#arg -> Float (149.0)

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

...を[-π,π]の範囲で返します。

//emlist[例][ruby]{
Complex
.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}

非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-
0.0 では値が変わります。

//emlist[例][ruby]{
Complex
(-1, 0)...
...3589793
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.14159...

Complex#phase -> Float (149.0)

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

...を[-π,π]の範囲で返します。

//emlist[例][ruby]{
Complex
.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}

非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-
0.0 では値が変わります。

//emlist[例][ruby]{
Complex
(-1, 0)...
...3589793
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.14159...

絞り込み条件を変える

Complex#denominator -> Integer (113.0)

分母を返します。

...と虚部の分母の最小公倍数を整数で返します。

1 2 3+4i <- numerator(分子)
-
+ -i -> ----
2 3 6 <- denominator(分母)

//emlist[例][ruby]{
Complex
('1/2+2/3i').denominator # => 6
Complex
(3).numerator # => 1
//}

@see Complex#numerator...

Complex#<=>(other) -> -1 | 0 | 1 | nil (108.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#conj -> Complex (107.0)

自身の共役複素数を返します。

...自身の共役複素数を返します。

//emlist[例][ruby]{
Complex
(1, 2).conj # => (1-2i)
//}...

Complex#conjugate -> Complex (107.0)

自身の共役複素数を返します。

...自身の共役複素数を返します。

//emlist[例][ruby]{
Complex
(1, 2).conj # => (1-2i)
//}...

Complex.polar(r, theta = 0) -> Complex (107.0)

絶対値が r、偏角が theta である Complex クラスのオブジェクトを生成します。

... Complex クラスのオブジェクトを生成します。

@param r 生成する複素数の絶対値。

@param theta 生成する複素数の偏角。単位はラジアンです。省略した場合は 0 です。

//emlist[例][ruby]{
Complex
.polar(2.0) # => (2.0+0.0i)
Complex
.po...
...lar(2.0, 0) # => (2.0+0.0i)
Complex
.polar(2.0, Math::PI) # => (-2.0+2.4492127076447545e-16i)
//}...

絞り込み条件を変える

<< 1 2 3 ... > >>