Units.pm

- NAME
- SYNOPSIS
- DESCRIPTION

- units( [UNITS] )
- dsin
- dcos
- tan
- sec
- csc
- cot
- asin
- acos
- atan
- asec
- acsc
- acot
- sinh
- cosh
- tanh
- sech
- csch
- coth
- asinh
- acosh
- atanh
- asech
- acsch
- acoth

- HISTORY
- BUGS
- AUTHOR

# NAME

        Math::Trig::Units - Inverse and hyperbolic trigonemetric Functions
                             in degrees, radians or gradians.

# SYNOPSIS

        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();

# DESCRIPTION

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().

### units( [UNITS] )

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

### dsin

returns sin of real argument.

### dcos

returns cos of real argument.

### tan

returns tangent of real argument.

### sec

returns secant of real argument.

### csc

returns cosecant of real argument.

### cot

returns cotangent of real argument.

### asin

returns inverse sine of real argument.

### acos

returns inverse cosine of real argument.

### atan

returns inverse tangent of real argument.

### asec

returns inverse secant of real argument.

### acsc

returns inverse cosecant of real argument.

### acot

returns inverse cotangent of real argument.

### sinh

returns hyperbolic sine of real argument.

### cosh

returns hyperbolic cosine of real argument.

### tanh

returns hyperbolic tangent of real argument.

### sech

returns hyperbolic secant of real argument.

### csch

returns hyperbolic cosecant of real argument.

### coth

returns hyperbolic cotangent of real argument.

### asinh

returns inverse hyperbolic sine of real argument.

### acosh

returns inverse hyperbolic cosine of real argument.

(positive value only)

### atanh

returns inverse hyperbolic tangent of real argument.

### asech

returns inverse hyperbolic secant of real argument.

(positive value only)

### acsch

returns inverse hyperbolic cosecant of real argument.

### acoth

returns inverse hyperbolic cotangent of real argument.

# HISTORY

Modification of Math::Trig by request from stefan_k.

# BUGS

All known ones have been fixed (see changes). Let me know if you find one.

# AUTHOR

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>

Units.pm