るりまサーチ

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

別のキーワード

  1. numeric step
  2. _builtin numeric
  3. numeric angle
  4. numeric polar
  5. numeric coerce

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Complex (38096.0)

複素数を扱うクラスです。

...

Complex
オブジェクトを作成するには、Kernel.#Complex
Complex
.rect、Complex.polar、Numeric#to_c、
String#to_c のいずれかを使用します。

//emlist[Complex オブジェクトの作り方][ruby]{
Complex
(1) # => (1+0i)
Complex
(2, 3) # => (2+3i)
Complex
.po...
...lar(2, 3) # => (-1.9799849932008908+0.2822400161197344i)
Complex
(0.3) # => (0.3+0i)
Complex
('0.3-0.5i') # => (0.3-0.5i)
Complex
('2/3+3/4i') # => ((2/3)+(3/4)*i)
Complex
('1@2') # => (-0.4161468365471424+0.9092974268256817i)
3.to_c # => (3+0i)
0.3.to_c # => (...
...# => ((2/3)+(3/4)*i)
'1@2'.to_c # => (-0.4161468365471424+0.9092974268256817i)
//}

Complex
オブジェクトは有理数の形式も実数の形式も扱う事ができます。

//emlist[例][ruby]{
Complex
(1, 1) / 2 # => ((1/2)+(1/2)*i)
Complex
(1, 1) / 2.0 # => (0.5+0.5i)
//}...

Complex#rect -> [Numeric, Numeric] (21228.0)

実部と虚部を配列にして返します。

...実部と虚部を配列にして返します。

//emlist[例][ruby]{
Complex
(3).rect # => [3, 0]
Complex
(3.5).rect # => [3.5, 0]
Complex
(3, 2).rect # => [3, 2]
//}

@see Numeric#rect...

Complex#rectangular -> [Numeric, Numeric] (21228.0)

実部と虚部を配列にして返します。

...実部と虚部を配列にして返します。

//emlist[例][ruby]{
Complex
(3).rect # => [3, 0]
Complex
(3.5).rect # => [3.5, 0]
Complex
(3, 2).rect # => [3, 2]
//}

@see Numeric#rect...

Complex#polar -> [Numeric, Numeric] (21214.0)

自身の絶対値と偏角を配列にして返します。

...自身の絶対値と偏角を配列にして返します。

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

@see Numeric#polar...

Complex#abs -> Numeric (21126.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#magnitude -> Numeric (21126.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 (21125.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#/(other) -> Complex (21120.0)

商を計算します。

...商を計算します。

@param other 自身を割る数

//emlist[例][ruby]{
Complex
(10.0) / 3 # => (3.3333333333333335+(0/1)*i)
Complex
(10) / 3 # => ((10/3)+(0/1)*i)
//}

@see Numeric#quo...

Complex#quo(other) -> Complex (21120.0)

商を計算します。

...商を計算します。

@param other 自身を割る数

//emlist[例][ruby]{
Complex
(10.0) / 3 # => (3.3333333333333335+(0/1)*i)
Complex
(10) / 3 # => ((10/3)+(0/1)*i)
//}

@see Numeric#quo...

Complex#imag -> Numeric (21114.0)

自身の虚部を返します。

...自身の虚部を返します。

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

@see Numeric#imag...

絞り込み条件を変える

<< 1 2 3 ... > >>