321件ヒット
[101-200件を表示]
(0.070秒)
ライブラリ
- ビルトイン (285)
-
irb
/ ext / math-mode (12) - matrix (12)
- rake (12)
クラス
- Complex (36)
- Float (57)
-
IRB
:: Context (12) - Integer (24)
- Module (48)
- Numeric (48)
-
Rake
:: FileList (12) - Range (24)
- Vector (12)
モジュール
- Enumerable (48)
キーワード
- angle (36)
-
angle
_ with (12) - arg (36)
- bsearch (24)
- digits (24)
- include (24)
- math? (4)
-
math
_ mode (4) -
math
_ mode= (4) -
max
_ by (48) -
module
_ function (36) - phase (36)
- polar (12)
- round (21)
検索結果
先頭5件
-
Float
# phase -> 0 | Float (17.0) -
自身の偏角(正の数なら 0、負の数なら Math::PI)を返します。
...自身の偏角(正の数なら 0、負の数なら Math::PI)を返します。
//emlist[例][ruby]{
1.arg # => 0
-1.arg # => 3.141592653589793
//}
ただし、自身が NaN(Not a number) であった場合は、NaN を返します。... -
Numeric
# polar -> [Numeric , Numeric] (17.0) -
自身の絶対値と偏角を配列にして返します。正の数なら [self, 0]、負の数な ら [-self, Math::PI] を返します。
...自身の絶対値と偏角を配列にして返します。正の数なら [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]
//}... -
Module
# include(*mod) -> self (13.0) -
モジュール mod をインクルードします。
...承の代わりに用いられており、 mix-in とも呼びます。
//emlist[例][ruby]{
class C
include FileTest
include Math
end
p C.ancestors
# => [C, Math, FileTest, Object, Kernel]
//}
モジュールの機能追加は、クラスの継承関係の間にそのモジュールが挿... -
Complex
# angle -> Float (7.0) -
自身の偏角を[-π,π]の範囲で返します。
...自身の偏角を[-π,π]の範囲で返します。
//emlist[例][ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}
非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。
//emlist[例][ruby]... -
Complex
# arg -> Float (7.0) -
自身の偏角を[-π,π]の範囲で返します。
...自身の偏角を[-π,π]の範囲で返します。
//emlist[例][ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}
非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。
//emlist[例][ruby]... -
Complex
# phase -> Float (7.0) -
自身の偏角を[-π,π]の範囲で返します。
...自身の偏角を[-π,π]の範囲で返します。
//emlist[例][ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}
非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。
//emlist[例][ruby]... -
Enumerable
# max _ by -> Enumerator (7.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...ue 5 (16 March 2006)
def wsample(n)
self.max_by(n) {|v| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000
a = e.wsample(20000) {|x|
Math.exp(-(x/5.0)**2) # normal distribution
}
# a is 20000 samples from e.
p a.length #=> 20000
h = a.group_by {|x| x }
-10.upto(10) {|x| puts "*" * (... -
Enumerable
# max _ by {|item| . . . } -> object | nil (7.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...ue 5 (16 March 2006)
def wsample(n)
self.max_by(n) {|v| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000
a = e.wsample(20000) {|x|
Math.exp(-(x/5.0)**2) # normal distribution
}
# a is 20000 samples from e.
p a.length #=> 20000
h = a.group_by {|x| x }
-10.upto(10) {|x| puts "*" * (... -
Enumerable
# max _ by(n) -> Enumerator (7.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...ue 5 (16 March 2006)
def wsample(n)
self.max_by(n) {|v| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000
a = e.wsample(20000) {|x|
Math.exp(-(x/5.0)**2) # normal distribution
}
# a is 20000 samples from e.
p a.length #=> 20000
h = a.group_by {|x| x }
-10.upto(10) {|x| puts "*" * (...