るりまサーチ

最速Rubyリファレンスマニュアル検索!
1183件ヒット [901-1000件を表示] (0.033秒)

別のキーワード

  1. math log
  2. math sqrt
  3. _builtin math
  4. bigdecimal/math e
  5. bigdecimal/math pi

ライブラリ

クラス

モジュール

オブジェクト

キーワード

検索結果

<< < ... 8 9 10 11 12 > >>

Module#include(*mod) -> self (12.0)

モジュール mod をインクルードします。

...承の代わりに用いられており、 mix-in とも呼びます。

//emlist[例][ruby]{
class C
include FileTest
include Math
end

p C.ancestors

# => [C, Math, FileTest, Object, Kernel]
//}

モジュールの機能追加は、クラスの継承関係の間にそのモジュールが挿...

Ruby用語集 (12.0)

Ruby用語集 A B C D E F G I J M N O R S Y

...dule function
モジュールのインスタンスメソッドおよび特異メソッドとして二重に定義されている
メソッド。Math モジュールのメソッドなどがこれにあたる。

Module#module_function を使って簡単に定義できる。

: 文字列
: strin...
...プログラム中に直接記述された値のこと。3.14 や "foo" や /\d+/ はリテラル
だが、1 + 2 はリテラルではない。
Math
::PI も定数参照なのでリテラルではない。

文字列リテラルが式展開を含む場合、実行時まで値が確定しな...

ruby 1.9 feature (12.0)

ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。

...ました [new]
#: VIS_MASK が 16
: ancestors にモジュールが複数回挿入できるようになりました
: Math#log2 追加 ((<ruby-talk:191237>)) [new]
: Math#log にオプショナルな第2引数 base 追加 ((<ruby-talk:191308>)) [compat]
: Array#flatten, Array#flatten! が...

Complex#angle -> Float (6.0)

自身の偏角を[-π,π]の範囲で返します。

...自身の偏角を[-π,π]の範囲で返します。

//emlist[例][ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}

非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。

//emlist[例][ruby]...

Complex#arg -> Float (6.0)

自身の偏角を[-π,π]の範囲で返します。

...自身の偏角を[-π,π]の範囲で返します。

//emlist[例][ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}

非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。

//emlist[例][ruby]...

絞り込み条件を変える

Complex#phase -> Float (6.0)

自身の偏角を[-π,π]の範囲で返します。

...自身の偏角を[-π,π]の範囲で返します。

//emlist[例][ruby]{
Complex.polar(3, Math::PI/2).arg # => 1.5707963267948966
//}

非正の実軸付近での挙動に注意してください。以下の例のように虚部が 0.0 と
-0.0 では値が変わります。

//emlist[例][ruby]...

Complex.polar(r, theta = 0) -> Complex (6.0)

絶対値が r、偏角が theta である Complex クラスのオブジェクトを生成します。

...

@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)
//}...

Enumerable#max_by -> Enumerator (6.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 (6.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 (6.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 "*" * (...

絞り込み条件を変える

<< < ... 8 9 10 11 12 > >>