557件ヒット
[1-100件を表示]
(0.028秒)
種類
- インスタンスメソッド (470)
- 文書 (43)
- クラス (24)
- ライブラリ (12)
- モジュール関数 (8)
モジュール
- Math (8)
キーワード
- -@ (12)
-
/ (35) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
NEWS for Ruby 2
. 1 . 0 (12) -
NEWS for Ruby 2
. 6 . 0 (7) - Ruby用語集 (12)
- abs (12)
- abs2 (12)
- angle (24)
- arg (24)
- conj (12)
- conjugate (12)
- denominator (12)
- fdiv (30)
- i (12)
- imag (24)
- imaginary (24)
- infinite? (9)
- magnitude (12)
- matrix (12)
- numerator (12)
- phase (24)
- polar (24)
- quo (24)
- real (24)
- real? (36)
- rect (24)
- rectangular (24)
- rsqrt (4)
- sqrt (4)
-
to
_ c (12)
検索結果
先頭5件
-
Numeric (44452.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...スです。Integer や Float などの数値クラス
は Numeric のサブクラスとして実装されています。
演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッドは、サブクラスで......提供されているメソッド
(+, -, *, /, %) を利用して定義されるものがほとんどです。
つまり Numeric で定義されているメソッドは、Numeric のサブクラスとして新たに数値クラスを定義した時に、
演算メソッド(+, -, *, /, %, <=>, coerce......を表しメソッド定義などではこの記法を利用します。
効率のため Numeric のメソッドと同じメソッドがサブクラスで再定義されている場合があります。
Numeric#coerce メソッドを使うことによって異なる数値クラス間で演算を... -
Complex (38102.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)
//}... -
Numeric
# rect -> [Numeric , Numeric] (30426.0) -
[self, 0] を返します。
...[self, 0] を返します。
//emlist[例][ruby]{
1.rect # => [1, 0]
-1.rect # => [-1, 0]
1.0.rect # => [1.0, 0]
-1.0.rect # => [-1.0, 0]
//}
Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。
@see Complex#rect... -
Numeric
# rectangular -> [Numeric , Numeric] (30426.0) -
[self, 0] を返します。
...[self, 0] を返します。
//emlist[例][ruby]{
1.rect # => [1, 0]
-1.rect # => [-1, 0]
1.0.rect # => [1.0, 0]
-1.0.rect # => [-1.0, 0]
//}
Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。
@see Complex#rect... -
Numeric
# polar -> [Numeric , Numeric] (30422.0) -
自身の絶対値と偏角を配列にして返します。正の数なら [self, 0]、負の数な ら [-self, Math::PI] を返します。
...します。
//emlist[例][ruby]{
1.0.polar # => [1.0, 0]
2.0.polar # => [2.0, 0]
-1.0.polar # => [1.0, 3.141592653589793]
-2.0.polar # => [2.0, 3.141592653589793]
//}
Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。
@see Complex#polar... -
Numeric
# real -> Numeric (30232.0) -
自身を返します。
...す。
Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。
//emlist[例][ruby]{
10.real # => 10
-10.real # => -10
0.1.real # => 0.1
Rational(2, 3).real # => (2/3)
//}
@see Numeric#imag、Complex#real... -
Numeric
# conj -> Numeric (30228.0) -
常に self を返します。
...常に self を返します。
自身が Complex かそのサブクラスのインスタンスの場合は、自身の共役複素数(実数の場合は常に自身)を返します。
Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。
//emli......st[例][ruby]{
10.conj # => 10
0.1.conj # => 0.1
(2/3r).conj # => (2/3)
//}
@see Complex#conj... -
Numeric
# conjugate -> Numeric (30228.0) -
常に self を返します。
...常に self を返します。
自身が Complex かそのサブクラスのインスタンスの場合は、自身の共役複素数(実数の場合は常に自身)を返します。
Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。
//emli......st[例][ruby]{
10.conj # => 10
0.1.conj # => 0.1
(2/3r).conj # => (2/3)
//}
@see Complex#conj... -
Numeric
# / (other) -> Numeric (30220.0) -
除算の演算子です。 self を other で割った商を返します。
...除算の演算子です。
self を other で割った商を返します。
Numeric では定義されておらず、サブクラスの実装によります。
@see Integer#/, Float#/, Rational#/, Complex#/...