るりまサーチ

最速Rubyリファレンスマニュアル検索!
893件ヒット [1-100件を表示] (0.122秒)
トップページ > クエリ:t[x] > クエリ:Ruby[x] > クエリ:Math[x]

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. matrix t
  4. t61string new
  5. fiddle type_size_t

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Math (44024.0)

浮動小数点演算をサポートするモジュールです。

...浮動小数点演算をサポートするモジュールです。

Math
モジュールにはさまざま数学関数がモジュール関数として定義されています。
モジュール関数は以下のように,モジュールの特異メソッドとして呼び出す使い方と、
...
...ジュールをインクルードしてレシーバーを省略した形で呼び出す使い方の両方ができます。

=== 例

//emlist[][ruby]{
pi = Math.atan2(1, 1)*4;
include Math
pi2 = atan2(1, 1)*4
//}...

Math.#atan2(y, x) -> Float (27130.0)

y / x の逆正接関数(arctangent)の値をラジアンで返します。

...逆正接関数(arctangent)の値をラジアンで返します。

@param y 実数
@param x 実数

@return 返される値の範囲は [-π, π] です。


//emlist[例][ruby]{
Math
.atan2(1,0) #=> 1.5707963267949
Math
.atan2(-1,0) #=> -1.5707963267949
//}

@raise TypeError y, x に数値...
...以外を指定した場合に発生します。

@raise RangeError y, x に実数以外の数値を指定した場合に発生します。

@see Math.#atan, Math.#tan...

Math.#sqrt(x) -> Float (27130.0)

x の非負の平方根(principal square root)を返します。

...x の非負の平方根(principal square root)を返します。

@param x 0または正の実数

@raise TypeError xに数値以外を指定した場合に発生します。

@raise Math::DomainError x に範囲外の実数を指定した場合に発生します。

@raise RangeError xに実...
...数以外の数値を指定した場合に発生します。

//emlist[例][ruby]{
0.upto(10) {|x|
p [x, Math.sqrt(x), Math.sqrt(x)**2]
}
# => [0, 0.0, 0.0]
# [1, 1.0, 1.0]
# [2, 1.4142135623731, 2.0]
# [3, 1.73205080756888, 3.0]
# [4, 2.0, 4.0]
# [5, 2.23606797749979, 5.0]
# [6, 2.449...
...48974278318, 6.0]
# [7, 2.64575131106459, 7.0]
# [8, 2.82842712474619, 8.0]
# [9, 3.0, 9.0]
# [10, 3.16227766016838, 10.0]
//}

@see Integer.sqrt, Math.#cbrt...

Math.#atan(x) -> Float (27124.0)

x の逆正接関数(arctangent)の値をラジアンで返します。

...x の逆正接関数(arctangent)の値をラジアンで返します。

@param x 実数

@return 返される値の範囲は [-π/2, +π/2] です。

@raise TypeError x に数値以外を指定した場合に発生します。

@raise RangeError x に実数以外の数値を指定した場合...
...に発生します。

//emlist[例][ruby]{
Math
.atan(0) # => 0.0
//}

@see Math.#atan2, Math.#tan...

Math.#cbrt(x) -> Float (27124.0)

x の立方根(cubic root)を返します。

...(cubic root)を返します。

@param x 実数

@raise TypeError xに数値以外を指定した場合に発生します。

@raise RangeError xに実数以外の数値を指定した場合に発生します。

//emlist[例][ruby]{
-9.upto(9) {|x|
p [x, Math.cbrt(x), Math.cbrt(x)**3]
}
# =>...
....0, -1.0]
# [0, 0.0, 0.0]
# [1, 1.0, 1.0]
# [2, 1.25992104989487, 2.0]
# [3, 1.44224957030741, 3.0]
# [4, 1.5874010519682, 4.0]
# [5, 1.7099759466767, 5.0]
# [6, 1.81712059283214, 6.0]
# [7, 1.91293118277239, 7.0]
# [8, 2.0, 8.0]
# [9, 2.0800838230519, 9.0]
//}

@see Math.#sqrt...

絞り込み条件を変える

Math.#tan(x) -> Float (27124.0)

x の正接関数(tangent)の値を返します。

...tangent)の値を返します。

@param x 実数(ラジアンで与えます)

@return 実数

@raise TypeError x に数値以外を指定した場合に発生します。

@raise RangeError x に実数以外の数値を指定した場合に発生します。

//emlist[例][ruby]{
Math
.tan...
...(0) # => 0.0
//}

@see Math.#atan, Math.#atan2...

Math.#hypot(x, y) -> Float (27112.0)

sqrt(x*x + y*y) を返します。

...sqrt(x*x + y*y) を返します。

この値は x, y を直交する 2 辺とする直角三角形の斜辺(hypotenuse)の長さです。

@param x 実数
@param y 実数

@raise TypeError 引数のどちらかに数値以外を指定した場合に発生します。

@raise RangeError 引数...
...のどちらかに実数以外の数値を指定した場合に発生します。

//emlist[例][ruby]{
Math
.hypot(3, 4) #=> 5.0
//}...

Math.#log(x) -> Float (24166.0)

x の対数(logarithm)を返します。

...数(logarithm)を返します。

引数 x, b の両方に 0 を指定した場合は Float::NAN を返します。

@param x 正の実数を指定します。

@param b 底を指定します。省略した場合は自然対数(natural logarithm)を計算します。

@raise TypeError 引数...
...らかに負の数を指定した場合に発生します。

//emlist[例][ruby]{
Math
.log(0) # => -Infinity
Math
.log(1) # => 0.0
Math
.log(Math::E) # => 1.0
Math
.log(Math::E**3) # => 3.0
Math
.log(12, 3) # => 2.2618595071429146
//}

@see Math.#log2, Math.#log10, Math.#exp...

Math.#log(x, b) -> Float (24166.0)

x の対数(logarithm)を返します。

...数(logarithm)を返します。

引数 x, b の両方に 0 を指定した場合は Float::NAN を返します。

@param x 正の実数を指定します。

@param b 底を指定します。省略した場合は自然対数(natural logarithm)を計算します。

@raise TypeError 引数...
...らかに負の数を指定した場合に発生します。

//emlist[例][ruby]{
Math
.log(0) # => -Infinity
Math
.log(1) # => 0.0
Math
.log(Math::E) # => 1.0
Math
.log(Math::E**3) # => 3.0
Math
.log(12, 3) # => 2.2618595071429146
//}

@see Math.#log2, Math.#log10, Math.#exp...
<< 1 2 3 ... > >>