ライブラリ
- ビルトイン (881)
- bigdecimal (11)
- cmath (120)
- fileutils (22)
-
json
/ add / complex (22) - mathn (8)
- matrix (133)
クラス
キーワード
- * (11)
- ** (11)
- + (11)
- - (11)
- -@ (22)
-
/ (21) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - < (11)
- <= (11)
- <=> (5)
- == (11)
- > (11)
- >= (11)
- I (11)
-
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 2
. 7 . 0 (5) - Numeric (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 (33)
- conjugate (33)
- copy (11)
- cos (6)
- cosh (6)
- cp (11)
- denominator (22)
- exp (6)
- fdiv (50)
- finite? (8)
- i (11)
- imag (33)
- imaginary (33)
- infinite? (16)
- inspect (11)
-
json
/ add / complex (11) -
json
_ create (11) - log (23)
- log10 (6)
- log2 (6)
- magnitude (22)
-
marshal
_ dump (11) - mathn (4)
- matrix (11)
- norm (11)
- numerator (22)
- phase (22)
- polar (33)
- quo (22)
- r (11)
- rationalize (22)
- real (33)
- real? (33)
- rect (33)
- rectangular (33)
- rsqrt (4)
- sin (6)
- sinh (6)
-
skew
_ symmetric? (6) -
slice
_ before (22) - sqrt (10)
- 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)
検索結果
-
NilClass
# to _ c -> Complex (101.0) -
0+0i を返します。
0+0i を返します。
//emlist[例][ruby]{
nil.to_c # => (0+0i)
//} -
Numeric (54.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...by 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Numeric Integer Fixnum Bignum Float Rational Complex
-------------------------------------------------------------------------------------------
% | o......o o o - -
Numeric Integer Fixnum Bignum Float Rational Complex
-------------------------------------------------------------------------------------------
<< | -......o o - - -
Numeric Integer Fixnum Bignum Float Rational Complex
-------------------------------------------------------------------------------------------
abs | o......い。
=> ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]
Numeric Integer Float Rational Complex
--------------------------------------------------------------------------------
% | o o o......< | - o o - -
Numeric Integer Float Rational Complex
--------------------------------------------------------------------------------
<< | - o -......^ | - o - - -
Numeric Integer Float Rational Complex
--------------------------------------------------------------------------------
abs | o o o... -
mathn (52.0)
-
Rational と Complex をよりシームレスに利用できるようにするライブラリです。数値ライブラリの挙動をグローバルに変更します。
...Rational と Complex をよりシームレスに利用できるようにするライブラリです。数値ライブラリの挙動をグローバルに変更します。
なお、このライブラリはRuby 2.2から非推奨(deprecated)になり、Ruby 2.5で削除されました。
引き続......1,1)
require 'mathn'
1/2 #=> Rational(1,2)
2 * Rational(1,2) #=> 1
==== 実数と複素数の相互変換
同様にして Complex のインスタンスの虚部が 0 ならば、実部として含まれていた Rational, Float, または Integer オブジェクトに変換......例外を発生していたような演算が Complex オブジェクトを返す場合もあります。
例:
Complex(0,-1)**2 #=> Complex(-1,0)
Math.sqrt(-1) #=> NaN
require 'mathn'
Complex(0,-1)**2 #=> -1
Math.sqrt(-1) #=> Complex(0,1)
=== 使用上の注意
なお、この挙... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (24.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...or using the mouse, character
attributes, colors and key codes have been added.
: Complex#to_i [lib] [obsolete]
: Complex#to_f [lib] [obsolete]
: Complex#to_r [lib] [obsolete]
Complex#to_i, #to_f, #to_r はなくなりました。
((<ruby-bugs-ja:PR#102>)), ((<ruby... -
Matrix
# conj -> Matrix (24.0) -
複素共役を取った行列を返します。
...複素共役を取った行列を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]]
# => 1+2i i 0
# 1 2 3
Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].conjugate
# => 1-2i -i 0
# 1 2 3
//}... -
Matrix
# conjugate -> Matrix (24.0) -
複素共役を取った行列を返します。
...複素共役を取った行列を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]]
# => 1+2i i 0
# 1 2 3
Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].conjugate
# => 1-2i -i 0
# 1 2 3
//}... -
Matrix
# imag -> Matrix (24.0) -
行列の虚部を返します。
...行列の虚部を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]]
# => 1+2i i 0
# 1 2 3
Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].imaginary
# => 2i i 0
# 0 0 0
//}... -
Matrix
# imaginary -> Matrix (24.0) -
行列の虚部を返します。
...行列の虚部を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]]
# => 1+2i i 0
# 1 2 3
Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].imaginary
# => 2i i 0
# 0 0 0
//}... -
Matrix
# real -> Matrix (24.0) -
行列の実部を返します。
...行列の実部を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]]
# => 1+2i i 0
# 1 2 3
Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].real
# => 1 0 0
# 1 2 3
//}... -
Matrix
# real? -> bool (24.0) -
行列の全要素が実(Numeric#real?)であれば true を返します。
...を返します。
Complexオブジェクトを要素に持つ場合は虚部が0でも偽を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[[1, 0], [0, 1]].real? # => true
Matrix[[Complex(0, 1), 0], [0, 1]].real? # => false
# 要素が実数であっても Complex オブジェクト......なら偽を返す。
Matrix[[Complex(1, 0), 0], [0, 1]].real? # => false
//}... -
NEWS for Ruby 2
. 1 . 0 (24.0) -
NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...付けると虚数単位 i を掛けた数になる
42i # => Complex(0, 42)
3.14i # => Complex(0, 3.14)
# ri を付けると複素数の虚部が有理数になる
42ri # => Complex(0, 42r)
3.14ri # => Complex(0, 3.14r)
//}
* def によるメソッド定義式は nil の...