227件ヒット
[1-100件を表示]
(0.016秒)
別のキーワード
種類
- インスタンスメソッド (198)
- モジュール関数 (18)
- ライブラリ (11)
ライブラリ
- ビルトイン (50)
- bigdecimal (12)
-
json
/ add / rational (11) - matrix (132)
- stringio (11)
モジュール
- Kernel (18)
キーワード
- BigDecimal (12)
- coerce (11)
- cofactor (11)
-
cofactor
_ expansion (11) - det (11)
-
det
_ e (11) - determinant (11)
-
determinant
_ e (11) -
elements
_ to _ r (11) - inspect (11)
-
laplace
_ expansion (11) - matrix (11)
- putc (11)
- rank (11)
-
to
_ json (11) -
to
_ r (11) -
to
_ s (11) - trace (11)
- truncate (11)
検索結果
先頭5件
-
Rational
# truncate(precision = 0) -> Rational | Integer (24273.0) -
小数点以下を切り捨てて値を整数に変換します。
...by]{
Rational(2, 3).to_i # => 0
Rational(3).to_i # => 3
Rational(300.6).to_i # => 300
Rational(98, 71).to_i # => 1
Rational(-31, 2).to_i # => -15
//}
precision を指定した場合は指定した桁数で切り捨てた整数か
Rational を返します。
//emlist[例][ruby]{
Rational('-......123.456').truncate(+1) # => (-617/5)
Rational('-123.456').truncate(+1).to_f # => -123.4
Rational('-123.456').truncate(0) # => -123
Rational('-123.456').truncate(-1) # => -120
//}
@see Rational#ceil, Rational#floor... -
Matrix
# tr -> Integer | Float | Rational | Complex (21203.0) -
トレース (trace) を返します。
...トレース (trace) を返します。
行列のトレース (trace) とは、対角要素の和です。
//emlist[例][ruby]{
require 'matrix'
Matrix[[7,6], [3,9]].trace # => 16
//}
trace は正方行列でのみ定義されます。
@raise ExceptionForMatrix::ErrDimensionMismatch 行列が... -
Rational
# inspect -> String (21130.0) -
自身を人間が読みやすい形の文字列表現にして返します。
...に10進数の表記を返します。
@return 有理数の表記にした文字列を返します。
//emlist[例][ruby]{
Rational(5, 8).inspect # => "(5/8)"
Rational(2).inspect # => "(2/1)"
Rational(-8, 6).inspect # => "(-4/3)"
Rational(0.5).inspect # => "(1/2)"
//}
@see Rational#to_s... -
Rational
# to _ s -> String (21130.0) -
自身を人間が読みやすい形の文字列表現にして返します。
..."-17/7" のように10進数の表記を返します。
@return 有理数の表記にした文字列を返します。
//emlist[例][ruby]{
Rational(3, 4).to_s # => "3/4"
Rational(8).to_s # => "8/1"
Rational(-8, 6).to_s # => "-4/3"
Rational(0.5).to_s # => "1/2"
//}
@see Rational#inspect... -
Rational
# to _ json(*args) -> String (21118.0) -
自身を JSON 形式の文字列に変換して返します。
...JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 使用しません。
//emlist[例][ruby]{
require 'json/add/rational'
Rational(1, 3).to_json # => "{\"json_class\":\"Rational\",\"n\":1,\"d\":3}"
//}
@see JSON::Generator::GeneratorMethods::Hash#to_json......@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json
に渡されます。
//emlist[例][ruby]{
require 'json/add/rational'
Rational(1, 3).to_json # => "{\"json_class\":\"Rational\",\"n\":1,\"d\":3}"
//}
@see JSON::Generator::GeneratorMethods::Hash#to_json... -
Kernel
. # Rational(x , y = 1 , exception: true) -> Rational | nil (18486.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... -
Matrix
# trace -> Integer | Float | Rational | Complex (9203.0) -
トレース (trace) を返します。
...トレース (trace) を返します。
行列のトレース (trace) とは、対角要素の和です。
//emlist[例][ruby]{
require 'matrix'
Matrix[[7,6], [3,9]].trace # => 16
//}
trace は正方行列でのみ定義されます。
@raise ExceptionForMatrix::ErrDimensionMismatch 行列が... -
matrix (6006.0)
-
行列と数ベクトルを扱うためのライブラリです。
...行列と数ベクトルを扱うためのライブラリです。
行列、ベクトルの各要素には Ruby の任意の数オブジェクト(Numeric の
サブクラス、Float, Integer, Complex, Rational など)
が使えます。... -
String
# to _ r -> Rational (3135.0) -
自身を有理数(Rational)に変換した結果を返します。
...自身を有理数(Rational)に変換した結果を返します。
Kernel.#Rational に文字列を指定した時のように、以下のいずれかの形
式で指定します。
* "1/3" のような分数の形式
* "0.3" のような10進数の形式
* "0.3E0" のような x.xEn の形.......2'.to_r # => (-46/5)
'-9.2E2'.to_r # => (-920/1)
'1_234_567'.to_r # => (1234567/1)
'1_234/5_678'.to_r # => (617/2839)
//}
Kernel.#Rational に文字列を指定した時とは異なる点もあります。
途中に変換できないような文字列が入っていた場合は、......# => (21/1)
'21/06/09'.to_r # => (7/2) # 21/6 を約分して 7/2。
//}
変換できないような文字列を指定した場合は 0/1 を返します。
//emlist[][ruby]{
'foo'.to_r # => (0/1)
''.to_r # => (0/1)
'bwv 1079'.to_r # => (0/1)
//}
@see Kernel.#Rational... -
Matrix
# elements _ to _ r -> Matrix (3116.0) -
各要素を有理数 Rational に変換した行列を返します。
...各要素を有理数 Rational に変換した行列を返します。
このメソッドは deprecated です。 map(&:to_r) を使ってください。...