1047件ヒット
[1-100件を表示]
(0.106秒)
ライブラリ
- ビルトイン (761)
- bigdecimal (11)
- cmath (120)
- fileutils (22)
-
json
/ add / complex (22) - matrix (89)
クラス
モジュール
- BigMath (11)
- CMath (120)
- Enumerable (22)
- FileUtils (22)
- Kernel (33)
キーワード
- * (11)
- ** (11)
- + (11)
- - (11)
- -@ (11)
-
/ (11) - < (11)
- <= (11)
- <=> (5)
- == (11)
- > (11)
- >= (11)
- I (11)
- Rational (11)
- Ruby用語集 (11)
- abs (11)
- abs2 (11)
- acos (6)
- acosh (6)
- angle (22)
- antisymmetric? (6)
- arg (22)
- asin (6)
- asinh (6)
- atan (6)
- atan2 (6)
- atanh (6)
- between? (11)
- cbrt (6)
- clamp (11)
- coerce (11)
- conj (11)
- conjugate (11)
- copy (11)
- cos (6)
- cosh (6)
- cp (11)
- denominator (11)
- exp (6)
- fdiv (39)
- finite? (8)
- i (11)
- imag (11)
- imaginary (11)
- infinite? (16)
- inspect (11)
-
json
/ add / complex (11) -
json
_ create (11) - log (23)
- log10 (6)
- log2 (6)
- magnitude (22)
-
marshal
_ dump (11) - norm (11)
- numerator (11)
- phase (22)
- polar (33)
- quo (22)
- r (11)
- rationalize (22)
- real (33)
- real? (33)
- rect (22)
- rectangular (33)
- sin (6)
- sinh (6)
-
skew
_ symmetric? (6) -
slice
_ before (22) - sqrt (6)
- tan (6)
- tanh (6)
-
to
_ c (44) -
to
_ f (11) -
to
_ i (11) -
to
_ json (11) -
to
_ r (11) -
to
_ s (11) - tr (11)
- trace (11)
検索結果
先頭5件
-
Complex (44090.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
# angle -> Float (30148.0) -
自身の偏角を[-π,π]の範囲で返します。
...で返します。
//emlist[例][ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}
非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。
//emlist[例][ruby]{
Complex(-1, 0).arg #=......> 3.141592653589793
Complex(-1, -0).arg #=> 3.141592653589793
Complex(-1, -0.0).arg #=> -3.141592653589793
Complex(0, 0.0).arg #=> 0.0
Complex(0, -0.0).arg #=> -0.0
Complex(-0.0, 0).arg #=> 3.141592653589793
Complex(-0.0, -0.0).arg... -
Complex
. rectangular(r , i = 0) -> Complex (27242.0) -
実部が r、虚部が i である Complex クラスのオブジェクトを生成します。
... 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
. polar(r , theta = 0) -> Complex (27235.0) -
絶対値が r、偏角が theta である Complex クラスのオブジェクトを生成します。
... Complex クラスのオブジェクトを生成します。
@param r 生成する複素数の絶対値。
@param theta 生成する複素数の偏角。単位はラジアンです。省略した場合は 0 です。
//emlist[例][ruby]{
Complex.polar(2.0) # => (2.0+0.0i)
Complex.polar......(2.0, 0) # => (2.0+0.0i)
Complex.polar(2.0, Math::PI) # => (-2.0+2.4492127076447545e-16i)
//}... -
Complex
# arg -> Float (27148.0) -
自身の偏角を[-π,π]の範囲で返します。
...で返します。
//emlist[例][ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}
非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。
//emlist[例][ruby]{
Complex(-1, 0).arg #=......> 3.141592653589793
Complex(-1, -0).arg #=> 3.141592653589793
Complex(-1, -0.0).arg #=> -3.141592653589793
Complex(0, 0.0).arg #=> 0.0
Complex(0, -0.0).arg #=> -0.0
Complex(-0.0, 0).arg #=> 3.141592653589793
Complex(-0.0, -0.0).arg... -
Complex
# phase -> Float (27148.0) -
自身の偏角を[-π,π]の範囲で返します。
...で返します。
//emlist[例][ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}
非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。
//emlist[例][ruby]{
Complex(-1, 0).arg #=......> 3.141592653589793
Complex(-1, -0).arg #=> 3.141592653589793
Complex(-1, -0.0).arg #=> -3.141592653589793
Complex(0, 0.0).arg #=> 0.0
Complex(0, -0.0).arg #=> -0.0
Complex(-0.0, 0).arg #=> 3.141592653589793
Complex(-0.0, -0.0).arg... -
Complex
# marshal _ dump -> Array (27128.0) -
Marshal.#load のためのメソッドです。 Complex::compatible#marshal_load で復元可能な配列を返します。
...Marshal.#load のためのメソッドです。
Complex::compatible#marshal_load で復元可能な配列を返します。
2.0 以降では Marshal.#load で 1.8 系の Complex オブジェクト
を保存した文字列も復元できます。
[注意] Complex::compatible は通常の方法で... -
Complex
# rectangular -> [Numeric , Numeric] (27118.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
# rationalize -> Rational (27112.0) -
自身を Rational に変換します。
...自身を Rational に変換します。
@param eps 許容する誤差。常に無視されます。
@raise RangeError 虚部が実数か、0 ではない場合に発生します。
//emlist[例][ruby]{
Complex(3).to_r # => (3/1)
Complex(3, 2).to_r # => RangeError
//}... -
Complex
# rationalize(eps) -> Rational (27112.0) -
自身を Rational に変換します。
...自身を Rational に変換します。
@param eps 許容する誤差。常に無視されます。
@raise RangeError 虚部が実数か、0 ではない場合に発生します。
//emlist[例][ruby]{
Complex(3).to_r # => (3/1)
Complex(3, 2).to_r # => RangeError
//}...