検索結果
先頭5件
-
Math
. # log(x) -> Float (1.0) -
x の対数(logarithm)を返します。
...らかに負の数を指定した場合に発生します。
//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 (1.0) -
x の対数(logarithm)を返します。
...らかに負の数を指定した場合に発生します。
//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
. # log10(x) -> Float (1.0) -
x の常用対数(common logarithm)を返します。
...se Math::DomainError x に範囲外の実数を指定した場合に発生します。
@raise RangeError xに実数以外の数値を指定した場合に発生します。
//emlist[例][ruby]{
Math.log10(1) # => 0.0
Math.log10(10) # => 1.0
Math.log10(10**100) # => 100.0
//}
@see Math.......#log, Math.#log2... -
Math
. # log2(x) -> Float (1.0) -
2 を底とする x の対数(binary logarithm)を返します。
...@raise Math::DomainError x に範囲外の実数を指定した場合に発生します。
@raise RangeError xに実数以外の数値を指定した場合に発生します。
//emlist[例][ruby]{
Math.log2(1) # => 0.0
Math.log2(2) # => 1.0
Math.log2(32768) # => 15.0
Math.log2(65536)......# => 16.0
//}
@see Math.#log, Math.#log10... -
Math
. # rsqrt(a) -> Numeric (1.0) -
@todo
@todo
複素数を考慮しないので、負の数や Complex をあたえないでください。
a が Float の時は、Float を返します。
それ以外の時、平方根が有理数であれば、Rational または Integer を返します。
無理数であれば、Float を返します。 -
Math
. # sin(x) -> Float (1.0) -
x の正弦関数(sine)の値を返します。
...ラジアンで与えます)
@return [-1, 1] の実数
@raise TypeError x に数値以外を指定した場合に発生します。
@raise RangeError x に実数以外の数値を指定した場合に発生します。
//emlist[例][ruby]{
Math.sin(Math::PI/2) # => 1.0
//}
@see Math.#asin... -
Math
. # sinh(x) -> Float (1.0) -
x の双曲線正弦関数(hyperbolic sine)の値を返します。
...(hyperbolic sine)の値を返します。
=== 定義
sinh(x) = (exp(x) - exp(-x)) / 2
@param x 実数
@raise TypeError x に数値以外を指定した場合に発生します。
@raise RangeError x に実数以外の数値を指定した場合に発生します。
@see Math.#asinh... -
Math
. # sqrt(a) -> Numeric (1.0) -
@todo
...@todo
a の正の平方根を返します。
a が Complex の時は、Complex を返します。
a が負の時は、a を正にして、その平方根を Complex の虚数部に入れて返します。
それ以外は、Math.rsqrt の結果を返します。... -
Math
. # sqrt(x) -> Float (1.0) -
x の非負の平方根(principal square root)を返します。
...合に発生します。
@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.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.44948974278318, 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
. # tan(x) -> Float (1.0) -
x の正接関数(tangent)の値を返します。
...実数(ラジアンで与えます)
@return 実数
@raise TypeError x に数値以外を指定した場合に発生します。
@raise RangeError x に実数以外の数値を指定した場合に発生します。
//emlist[例][ruby]{
Math.tan(0) # => 0.0
//}
@see Math.#atan, Math.#atan2... -
Math
. # tanh(x) -> Float (1.0) -
x の双曲線正接関数(hyperbolic tangent)の値を返します。
...返します。
=== 定義
tanh(x) = sinh(x) / cosh(x)
@param x 実数
@return [-1, 1] の範囲の実数
@raise TypeError x に数値以外を指定した場合に発生します。
@raise RangeError x に実数以外の数値を指定した場合に発生します。
@see Math.#atanh...