> For the complete documentation index, see [llms.txt](https://calctree.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://calctree.gitbook.io/docs/calculations/creating-calculations/maths-equations/native-functions/trigonometric-functions.md).

# Trigonometric functions

CalcTree supports a full range of trigonometric and hyperbolic functions using [MathJS syntax](https://mathjs.org/docs/reference/functions.html#trigonometry). All trigonometric functions operate using **radians** by default.

To convert degrees to radians, use:

```lua
deg * (pi / 180)  
```

To convert radians to degrees:

```lua
rad * (180 / pi)  
```

### Standard Trigonometric Functions

| Function | Description | CalcTree Example    |
| -------- | ----------- | ------------------- |
| `sin(x)` | Sine        | `sin(pi / 2)` → `1` |
| `cos(x)` | Cosine      | `cos(0)` → `1`      |
| `tan(x)` | Tangent     | `tan(pi / 4)` → `1` |
| `cot(x)` | Cotangent   | `cot(pi / 4)` → `1` |
| `sec(x)` | Secant      | `sec(0)` → `1`      |
| `csc(x)` | Cosecant    | `csc(pi / 2)` → `1` |

### Inverse Trigonometric Functions

| Function      | Description                 | CalcTree Example         |
| ------------- | --------------------------- | ------------------------ |
| `asin(x)`     | Inverse sine                | `asin(1)` → `pi / 2`     |
| `acos(x)`     | Inverse cosine              | `acos(1)` → `0`          |
| `atan(x)`     | Inverse tangent             | `atan(1)` → `pi / 4`     |
| `atan2(y, x)` | 2-arg inverse tangent (y/x) | `atan2(3, 3)` → `pi / 4` |
| `acot(x)`     | Inverse cotangent           | `acot(1)` → `pi / 4`     |
| `asec(x)`     | Inverse secant              | `asec(1)` → `0`          |
| `acsc(x)`     | Inverse cosecant            | `acsc(1)` → `pi / 2`     |

### Hyperbolic Trigonometric Functions

| Function  | Description          | CalcTree Example      |
| --------- | -------------------- | --------------------- |
| `sinh(x)` | Hyperbolic sine      | `sinh(0)` → `0`       |
| `cosh(x)` | Hyperbolic cosine    | `cosh(0)` → `1`       |
| `tanh(x)` | Hyperbolic tangent   | `tanh(0)` → `0`       |
| `coth(x)` | Hyperbolic cotangent | `coth(1)` → `1.31...` |
| `sech(x)` | Hyperbolic secant    | `sech(0)` → `1`       |
| `csch(x)` | Hyperbolic cosecant  | `csch(1)` → `0.85...` |

### Inverse Hyperbolic Functions

| Function   | Description                  | CalcTree Example          |
| ---------- | ---------------------------- | ------------------------- |
| `asinh(x)` | Inverse hyperbolic sine      | `asinh(1)` → `0.881...`   |
| `acosh(x)` | Inverse hyperbolic cosine    | `acosh(2)` → `1.317...`   |
| `atanh(x)` | Inverse hyperbolic tangent   | `atanh(0.5)` → `0.549...` |
| `acoth(x)` | Inverse hyperbolic cotangent | `acoth(2)` → `0.549...`   |
| `asech(x)` | Inverse hyperbolic secant    | `asech(0.5)` → `1.317...` |
| `acsch(x)` | Inverse hyperbolic cosecant  | `acsch(2)` → `0.481...`   |

### Notes for CalcTree

* All trigonometric functions use radians by default.
* Inputs can include units (e.g., degrees), but they must be converted to radians manually for most trigonometric functions.
* Results are unitless unless explicitly wrapped in unit conversion logic.

{% hint style="info" %}
📘 **Looking for more functions?**\
CalcTree’s expression engine is powered by [MathJS](https://mathjs.org/docs/reference/functions.html).\
For a full list of available functions, visit the [MathJS Function Reference](https://mathjs.org/docs/reference/functions.html).\
Most functions listed there are supported in CalcTree unless otherwise noted.
{% endhint %}
