Math::Trig::Units - Inverse and hyperbolic trigonemetric Functions in degrees, radians or gradians.
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); # set radians instead of degrees (default) Math::Trig::Units::units('radians'); # set gradians as units Math::Trig::Units::units('gradians'); # set degrees as units Math::Trig::Units::units('degrees'); # return current unit setting $units = Math::Trig::Units::units();
This module exports the missing inverse and hyperbolic trigonometric functions of real numbers. The inverse functions return values cooresponding to the principal values. Specifying an argument outside of the domain of the function where an illegal divion by zero would occur will cause infinity to be returned. Infinity is Perl's version of this.
This module implements the functions in radians by default. You set the units via the units sub:
# set radians as units (default) Math::Trig::Units::units('radians'); # set gradians as units Math::Trig::Units::units('gradians'); # set degrees as units Math::Trig::Units::units('degrees'); # return current unit setting $units = Math::Trig::Units::units();
To avoid redefining the internal sin() and cos() functions this module calls the functions dsin() and dcos().
Set or get the units. Options are 'radians', 'degrees', 'gradians' and are case insensitive. When called without an argument this function returns the current units setting. Alternatively you can call the subclasses:
Math::Trig::Degree Math::Trig::Radian Math::Trig::Gradian
returns sin of real argument.
returns cos of real argument.
returns tangent of real argument.
returns secant of real argument.
returns cosecant of real argument.
returns cotangent of real argument.
returns inverse sine of real argument.
returns inverse cosine of real argument.
returns inverse tangent of real argument.
returns inverse secant of real argument.
returns inverse cosecant of real argument.
returns inverse cotangent of real argument.
returns hyperbolic sine of real argument.
returns hyperbolic cosine of real argument.
returns hyperbolic tangent of real argument.
returns hyperbolic secant of real argument.
returns hyperbolic cosecant of real argument.
returns hyperbolic cotangent of real argument.
returns inverse hyperbolic sine of real argument.
returns inverse hyperbolic cosine of real argument.
(positive value only)
returns inverse hyperbolic tangent of real argument.
returns inverse hyperbolic secant of real argument.
returns inverse hyperbolic cosecant of real argument.
returns inverse hyperbolic cotangent of real argument.
Modification of Math::Trig by request from stefan_k.
All known ones have been fixed (see changes). Let me know if you find one.
Initial Version John A.R. Williams <J.A.R.Williams@aston.ac.uk> Bug fixes and many additonal functions Jason Smith <smithj4@rpi.edu> This version James Freeman <james.freeman@id3.org.uk>
To install Math::Trig::Units, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Trig::Units
CPAN shell
perl -MCPAN -e shell install Math::Trig::Units
For more information on module installation, please visit the detailed CPAN module installation guide.