るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. matrix t
  4. t61string new
  5. fiddle type_size_t

ライブラリ

キーワード

検索結果

Complex#rect -> [Numeric, Numeric] (18904.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] (18904.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#inspect -> String (18604.0)

自身を人間が読みやすい形の文字列表現にして返します。

...

//emlist[例][ruby]{
Complex
(2).inspect # => "(2+0i)"
Complex
('-8/6').inspect # => "((-4/3)+0i)"
Complex
('1/2i').inspect # => "(0+(1/2)*i)"
Complex
(0, Float::INFINITY).inspect # => "(0+Infinity*i)"
Complex
(Float::NAN, Float::NAN).insp...

Complex#to_json(*args) -> String (18604.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...

Complex#to_s -> String (18604.0)

自身を "実部 + 虚部i" 形式の文字列にして返します。

...て返します。

//emlist[例][ruby]{
Complex
(2).to_s # => "2+0i"
Complex
('-8/6').to_s # => "-4/3+0i"
Complex
('1/2i').to_s # => "0+1/2i"
Complex
(0, Float::INFINITY).to_s # => "0+Infinity*i"
Complex
(Float::NAN, Float::NAN).to_s # => "Na...

絞り込み条件を変える

Complex#magnitude -> Numeric (9604.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...