Location : Home > Languages > Perl > Package Title : Math::Trig::Units |
![]() |
Math::Trig::Units - 逆三角関数及び双曲線関数
use Math::Trig::Units qw(dsin dcos tan sec csc cot asin acos atan asec acsc acot sinh cosh tanh sech csch coth asinh acosh atanh asech acsch acoth deg_to_rad rad_to_deg grad_to_rad rad_to_grad deg_to_grad grad_to_deg units ); $v = dsin($x); $v = dcos($x); $v = tan($x); $v = sec($x); $v = csc($x); $v = cot($x); $v = asin($x); $v = acos($x); $v = atan($x); $v = asec($x); $v = acsc($x); $v = acot($x); $v = sinh($x); $v = cosh($x); $v = tanh($x); $v = sech($x); $v = csch($x); $v = coth($x); $v = asinh($x); $v = acosh($x); $v = atanh($x); $v = asech($x); $v = acsch($x); $v = acoth($x); $degrees = rad_to_deg($radians); $radians = deg_to_rad($degrees); $degrees = grad_to_deg($gradians); $gradians = deg_to_grad($degrees); $radians = grad_to_rad($gradians); $gradians = rad_to_grad($radians); # 度のかわりにラジアンに設定(デフォルト) Math::Trig::Units::units('radians'); # グラジアンを単位として設定 Math::Trig::Units::units('gradians'); # 度を単位として設定 Math::Trig::Units::units('degrees'); # 現在の単位設定を返す $units = Math::Trig::Units::units();
本モジュールは実数に対する逆及びハイパボリック三角関数をエクスポートする。逆関数は主値に対する値を返す。関数の定義域の外側の引数を与えることはゼロ割を起こすなど無限大を返す原因となる。無限大とは Perl によるものである。
本モジュールはデフォルトではラジアンで実装されている。以下の設定で単位を変更できる。
# 度のかわりにラジアンに設定(デフォルト) Math::Trig::Units::units('radians'); # グラジアンを単位として設定 Math::Trig::Units::units('gradians'); # 度を単位として設定 Math::Trig::Units::units('degrees'); # 現在の単位設定を返す $units = Math::Trig::Units::units();
内部で sin() 及び cos() 関数を再定義することを防ぐために本モジュールでは関数 dsin() 及び dcos() を呼び出している。
units( [UNITS] )
単位を設定または取得する。オプションは 'radians', 'degrees', 'gradians' であり、大文字小文字を区別する。引数なしでこの関数を呼び出したときには現在の設定を返す。または以下のようにサブクラスを呼び出してもよい。
Math::Trig::Degree
Math::Trig::Radian
Math::Trig::Gradian
dsin
実引数の sin を返す。
dcos
実引数の cos を返す。
tan
実引数の tangent を返す。
sec
実引数の secant を返す。
csc
実引数の cosecant を返す。
cot
実引数の cotangent を返す。
asin
実引数の逆 sine を返す。
acos
実引数の 逆 cosine を返す。
atan
実引数の逆 tangent を返す。
asec
実引数の逆 secant を返す。
acsc
実引数の逆 cosecant を返す。
acot
実引数の逆 cotangent を返す。
sinh
実引数のハイパボリック sine を返す。
cosh
実引数のハイパボリック cosine を返す。
tanh
実引数のハイパボリック tangent を返す。
sech
実引数のハイパボリック secant を返す。
csch
実引数のハイパボリック cosecant を返す。
coth
実引数のハイパボリック cotangent を返す。
asinh
実引数の逆ハイパボリック sine を返す。
acosh
実引数の逆ハイパボリック cosine を返す。(正の値のみ)
atanh
実引数の逆ハイパボリック tangent を返す。
asech
実引数の逆ハイパボリック secant を返す。(正の値のみ)
acsch
実引数の逆ハイパボリック cosecant を返す。
acoth
実引数の逆ハイパボリック cotangent を返す。
stefan_k からの要請で Math::Trig を修正。
既知のバグは修正した。もし見つかれば教えて欲しい。
初期バージョンは John A.R. Williams, <J.A.R.Williams@aston.ac.uk>
バグフィクス及び多くの関数を追加したのは Jason Smith, <smithj4@rpi.edu>
現在のバージョンは James Freeman, <james.freeman@id3.org.uk>
![]() |
Updated : 2007/06/04 |