るりまサーチ

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

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. matrix i
  5. csv to_i

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 5 > >>

Complex.rectangular(r, i = 0) -> Complex (143.0)

実部が r、虚部が i である Complex クラスのオブジェクトを生成します。

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

@param r 生成する複素数の実部。

@param i 生成する複素数の虚部。省略した場合は 0 です。

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

@see Kernel.#Complex...

Complex#to_json(*args) -> String (107.0)

自身を JSON 形式の文字列に変換して返します。

...ら JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 使用しません。

//emlist[例][ruby]{
require 'json/add/complex'
Complex
(2, 3).to_json # => "{\"json_class\":\"Complex\",\"r\":2,\"i\":3}"
//}

@see JSON::Generator::GeneratorMethods::Hash#to_json...
...@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json
に渡されます。

//emlist[例][ruby]{
require 'json/add/complex'
Complex
(2, 3).to_json # => "{\"json_class\":\"Complex\",\"r\":2,\"i\":3}"
//}

@see JSON::Generator::GeneratorMethods::Hash#to_json...

Complex#<=>(other) -> -1 | 0 | 1 | nil (101.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#abs -> Numeric (101.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 (101.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#between?(min, max) -> bool (101.0)

@undef

@undef

Complex#real -> Numeric (101.0)

自身の実部を返します。

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

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

Complex#*(other) -> Complex (19.0)

積を計算します。

...積を計算します。

@param other 自身に掛ける数

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

Complex#numerator -> Complex (19.0)

分子を返します。

...分子を返します。

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

@see Complex#denominator...

Complex.polar(r, theta = 0) -> Complex (19.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)
//}...

絞り込み条件を変える

Complex#**(other) -> Complex (13.0)

冪(べき)乗を計算します。

...冪(べき)乗を計算します。

@param other 自身を other 乗する数

//emlist[例][ruby]{
Complex
('i') ** 2 # => (-1+0i)
//}...
<< < 1 2 3 4 5 > >>