---
name: "trig"
section: "3tcl"
platform: "linux"
package: "tcllib"
version: "2.0+dfsg-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/trig"
---

# trig(3tcl)

Trigonometric anf hyperbolic functions

```

```

## NAME

math::trig - Trigonometric anf hyperbolic functions

## SYNOPSIS

package require **Tcl 8.5 9**

package require **math::trig 1.1**

**::math::trig::radian\_reduced** *angle*

**::math::trig::degree\_reduced** *angle*

**::math::trig::cosec** *angle*

**::math::trig::sec** *angle*

**::math::trig::cotan** *angle*

**::math::trig::acosec** *value*

**::math::trig::asec** *value*

**::math::trig::acotan** *value*

**::math::trig::cosech** *value*

**::math::trig::sech** *value*

**::math::trig::cotanh** *value*

**::math::trig::asinh** *value*

**::math::trig::acosh** *value*

**::math::trig::atanh** *value*

**::math::trig::acosech** *value*

**::math::trig::asech** *value*

**::math::trig::acotanh** *value*

**::math::trig::sind** *angle*

**::math::trig::cosd** *angle*

**::math::trig::tand** *angle*

**::math::trig::cosecd** *angle*

**::math::trig::secd** *angle*

**::math::trig::cotand** *angle*

```

```

## DESCRIPTION

The *math::trig* package defines a set of trigonomic and hyperbolic functions and their inverses. In addition it defines versions of the trigonomic functions that take arguments in degrees instead of radians.

For easy use these functions may be imported into the *tcl::mathfunc* namespace, so that they can be used directly in the *expr* command.

## FUNCTIONS

The functions *radian\_reduced* and *degree\_reduced* return a reduced angle, in respectively radians and degrees, in the intervals \[0, 2pi) and \[0, 360):

- **::math::trig::radian\_reduced** *angle*

  Return the equivalent angle in the interval \[0, 2pi).

  - float *angle*

    Angle (in radians)

- **::math::trig::degree\_reduced** *angle*

  Return the equivalent angle in the interval \[0, 360).

  - float *angle*

    Angle (in degrees)

The following trigonomic functions are defined in addition to the ones defined in the *expr* command:

- **::math::trig::cosec** *angle*

  Calculate the cosecant of the angle (1/cos(angle))

  - float *angle*

    Angle (in radians)

- **::math::trig::sec** *angle*

  Calculate the secant of the angle (1/sin(angle))

  - float *angle*

    Angle (in radians)

- **::math::trig::cotan** *angle*

  Calculate the cotangent of the angle (1/tan(angle))

  - float *angle*

    Angle (in radians)

For these functions also the inverses are defined:

- **::math::trig::acosec** *value*

  Calculate the arc cosecant of the value

  - float *value*

    Value of the argument

- **::math::trig::asec** *value*

  Calculate the arc secant of the value

  - float *value*

    Value of the argument

- **::math::trig::acotan** *value*

  Calculate the arc cotangent of the value

  - float *value*

    Value of the argument

The following hyperbolic and inverse hyperbolic functions are defined:

- **::math::trig::cosech** *value*

  Calculate the hyperbolic cosecant of the value (1/sinh(value))

  - float *value*

    Value of the argument

- **::math::trig::sech** *value*

  Calculate the hyperbolic secant of the value (1/cosh(value))

  - float *value*

    Value of the argument

- **::math::trig::cotanh** *value*

  Calculate the hyperbolic cotangent of the value (1/tanh(value))

  - float *value*

    Value of the argument

- **::math::trig::asinh** *value*

  Calculate the arc hyperbolic sine of the value

  - float *value*

    Value of the argument

- **::math::trig::acosh** *value*

  Calculate the arc hyperbolic cosine of the value

  - float *value*

    Value of the argument

- **::math::trig::atanh** *value*

  Calculate the arc hyperbolic tangent of the value

  - float *value*

    Value of the argument

- **::math::trig::acosech** *value*

  Calculate the arc hyperbolic cosecant of the value

  - float *value*

    Value of the argument

- **::math::trig::asech** *value*

  Calculate the arc hyperbolic secant of the value

  - float *value*

    Value of the argument

- **::math::trig::acotanh** *value*

  Calculate the arc hyperbolic cotangent of the value

  - float *value*

    Value of the argument

The following versions of the common trigonometric functions and their inverses are defined:

- **::math::trig::sind** *angle*

  Calculate the sine of the angle (in degrees)

  - float *angle*

    Angle (in degrees)

- **::math::trig::cosd** *angle*

  Calculate the cosine of the angle (in degrees)

  - float *angle*

    Angle (in radians)

- **::math::trig::tand** *angle*

  Calculate the cotangent of the angle (in degrees)

  - float *angle*

    Angle (in degrees)

- **::math::trig::cosecd** *angle*

  Calculate the cosecant of the angle (in degrees)

  - float *angle*

    Angle (in degrees)

- **::math::trig::secd** *angle*

  Calculate the secant of the angle (in degrees)

  - float *angle*

    Angle (in degrees)

- **::math::trig::cotand** *angle*

  Calculate the cotangent of the angle (in degrees)

  - float *angle*

    Angle (in degrees)

## BUGS, IDEAS, FEEDBACK

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category *math :: trig* of the *Tcllib Trackers* \[http://core.tcl.tk/tcllib/reportlist\]. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide *unified diffs*, i.e the output of **diff -u**.

Note further that *attachments* are strongly preferred over inlined patches. Attachments can be made by going to the **Edit** form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

## KEYWORDS

math, trigonometry

## CATEGORY

Mathematics

## COPYRIGHT

```
Copyright (c) 2018 Arjen Markus
```
