るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

検索結果

<< 1 2 > >>

Complex#*(other) -> Complex (39261.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#inspect -> String (27278.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).inspect...
...# => "(NaN+NaN*i)"
//}...

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

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

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

@param other 自身を other 乗する数

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

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

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

...虚部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 # => "NaN+NaN*i"
//}...

絞り込み条件を変える

Kernel.#Complex(r, i = 0) -> Complex (18535.0)

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

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

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

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

@param s 生成する複素数を表す文字列。


@raise ArgumentError 変換...
...//emlist[例][ruby]{
Complex
(1) # => (1+0i)
Complex
(1, 2) # => (1+2i)
Complex
('1+1i') # => (1+1i)
Complex
('1+1j') # => (1+1i)
# Complex.polar(10, 10) と同一。
Complex
('10@10') # => (-8.390715290764524-5.440211108893697i)
Complex
('_') # => ArgumentError
//}

r にも i にも複...
...
Complex
(a, b) を a+bi として計算した Complex オブジェクトを返しま
す。

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

@see Complex.rect、Complex.rectangular

[注意] Complex...

Kernel.#Complex(r, i = 0, exception: true) -> Complex | nil (18535.0)

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

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

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

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

@param s 生成する複素数を表す文字列。

@param exception false を指定す...
...代わりに nil を返します。

@raise ArgumentError 変換できないオブジェクトを指定した場合に発生します。

//emlist[例][ruby]{
Complex
(1) # => (1+0i)
Complex
(1, 2) # => (1+2i)
Complex
('1+1i') # => (1+1i)
Complex
('1+1j') # => (1+1i)
# Complex.polar(10, 10)...
... i にも複素数と解釈されるオブジェクトを指定した場合には、
Complex
(a, b) を a+bi として計算した Complex オブジェクトを返しま
す。

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

Kernel.#Complex(s, exception: true) -> Complex | nil (18535.0)

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

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

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

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

@param s 生成する複素数を表す文字列。

@param exception false を指定す...
...代わりに nil を返します。

@raise ArgumentError 変換できないオブジェクトを指定した場合に発生します。

//emlist[例][ruby]{
Complex
(1) # => (1+0i)
Complex
(1, 2) # => (1+2i)
Complex
('1+1i') # => (1+1i)
Complex
('1+1j') # => (1+1i)
# Complex.polar(10, 10)...
... i にも複素数と解釈されるオブジェクトを指定した場合には、
Complex
(a, b) を a+bi として計算した Complex オブジェクトを返しま
す。

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

Kernel.#Complex(s) -> Complex (18435.0)

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

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

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

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

@param s 生成する複素数を表す文字列。


@raise ArgumentError 変換...
...//emlist[例][ruby]{
Complex
(1) # => (1+0i)
Complex
(1, 2) # => (1+2i)
Complex
('1+1i') # => (1+1i)
Complex
('1+1j') # => (1+1i)
# Complex.polar(10, 10) と同一。
Complex
('10@10') # => (-8.390715290764524-5.440211108893697i)
Complex
('_') # => ArgumentError
//}

r にも i にも複...
...
Complex
(a, b) を a+bi として計算した Complex オブジェクトを返しま
す。

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

@see Complex.rect、Complex.rectangular

[注意] Complex...

Kernel.#Rational(x, y = 1, exception: true) -> Rational | nil (6342.0)

引数を有理数(Rational)に変換した結果を返します。

...を有理数(Rational)に変換した結果を返します。

@param x 変換対象のオブジェクトです。

@param y 変換対象のオブジェクトです。省略した場合は x だけを用いて
Rational オブジェクトを作成します。

@param exception false を指...
...x/y した Rational オブジェクトを
返します。

//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational(1, 3) # => (1/3)
Rational("0.1", "0.3") # => (1/3)
Rational(Complex(1,2), 2) # => ((1/2)+(1/1)*i)
//}

ただし、1.8系とは異なり、Rational オブジェ...
...ださい。

//emlist[例][ruby]{
Rational(2, 6) # => (1/3)
Rational(1, 3) * 3 # => (1/1)
//}

引数に文字列を指定する場合、以下のいずれかの形式で指定します。

*
"1/3" のような分数の形式
*
"0.3" のような10進数の形式
*
"0.3E0" のよう...

絞り込み条件を変える

Kernel.#Rational(x, y = 1) -> Rational (6242.0)

引数を有理数(Rational)に変換した結果を返します。

...数を有理数(Rational)に変換した結果を返します。

@param x 変換対象のオブジェクトです。

@param y 変換対象のオブジェクトです。省略した場合は x だけを用いて
Rational オブジェクトを作成します。


@raise ArgumentError 変換...
...x/y した Rational オブジェクトを
返します。

//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational(1, 3) # => (1/3)
Rational("0.1", "0.3") # => (1/3)
Rational(Complex(1,2), 2) # => ((1/2)+(1/1)*i)
//}

ただし、1.8系とは異なり、Rational オブジェ...
...ださい。

//emlist[例][ruby]{
Rational(2, 6) # => (1/3)
Rational(1, 3) * 3 # => (1/1)
//}

引数に文字列を指定する場合、以下のいずれかの形式で指定します。

*
"1/3" のような分数の形式
*
"0.3" のような10進数の形式
*
"0.3E0" のよう...

Numeric (6108.0)

数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。

...値を表す抽象クラスです。Integer や Float などの数値クラス
は Numeric のサブクラスとして実装されています。

演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッド...
...ているメソッド
(+, -, *, /, %) を利用して定義されるものがほとんどです。
つまり Numeric で定義されているメソッドは、Numeric のサブクラスとして新たに数値クラスを定義した時に、
演算メソッド(+, -, *, /, %, <=>, coerce)だけを...
...
れのクラスを参照してください。


=> ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Numeric Integer Fixnum Bignum Float Rational Complex
---------------------------------------------------------------------------...
...はそれぞ
れのクラスを参照してください。


=> ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]
Numeric Integer Float Rational Complex
--------------------------------------------------------------------------------...

String#to_c -> Complex (3303.0)

自身を複素数 (Complex) に変換した結果を返します。

...自身を複素数 (Complex) に変換した結果を返します。

以下の形式を解析できます。i、j は大文字、小文字のどちらでも解析できます。

*
実部+虚部i
*
実部+虚部j
*
絶対値@偏角

それぞれの数値は以下のいずれかの形式で指...
...ます。

*
"1/3" のような分数の形式
*
"0.3" のような10進数の形式
*
"0.3E0" のような x.xEn の形式

自身が解析できない値であった場合は 0+0i を返します。

//emlist[例][ruby]{
'9'.to_c # => (9+0i)
'2.5'.to_c # => (2.5+0i)
'2.5/1'.to...
..._c # => ((5/2)+0i)
'-3/2'.to_c # => ((-3/2)+0i)
'-i'.to_c # => (0-1i)
'45i'.to_c # => (0+45i)
'3-4i'.to_c # => (3-4i)
'-4e2-4e-2i'.to_c # => (-400.0-0.04i)
'-0.0-0.0i'.to_c # => (-0.0-0.0i)
'1/2+3/4i'.to_c # => ((1/2)+(3/4)*i)
'10@10'.to_c # => (-8.39...
<< 1 2 > >>