math/tan
===============================================================================
%% Tangent of argument in radians
1. Usage
-------------------------------------------------------------------------------
```mech:disabled
Y := math/tan(X)
```
2. Description
-------------------------------------------------------------------------------
Computes the tangent of each element of `X`. The input `X` is interpreted in radians, not degrees. The result `Y` has the same shape as the input `X`.
3. Input
-------------------------------------------------------------------------------
| Argument | Kind | Description |
|----------|--------------------------|---------------------------------------|
| `X` | `float`, `[float]` | Input angle(s) specified in radians. Can be real or complex. If `X` is complex, tan returns complex results. |
4. Output
-------------------------------------------------------------------------------
| Argument | Kind | Description |
|----------|--------------------------|---------------------------------------|
| `Y` | matches input | Tangent of the input values. For real `X`, `Y` may take any real value (unbounded). For complex `X`, `Y` may have both real and imaginary parts. The shape of `Y` matches the shape of `X`. |
5. Examples
-------------------------------------------------------------------------------
(a) Find the tangent of a number
```mech:ex1
y := math/tan(3.14)
```
(b) Find the tangent for a vector of numbers
```mech:ex2
x := [0, 1.57, 3.14]
y := math/tan(x)
```
(c) Find the tangent for a matrix of numbers
```mech:ex3
x := [0, 1; 3 4]
y := math/tan(x)
```
(d) Find the tangent for a matrix of degrees
```mech:ex4
x := [0, 45; 90, 180]
y := math/tan(x * 3.14 / 180)
```
6. Details
-------------------------------------------------------------------------------
The tangent function is another key idea in trigonometry, relating angles to ratios of sides in right triangles.
In a right triangle, the tangent of an angle $$x$$ is defined as the ratio of the length of the opposite side to the adjacent side:
$$ tan(x) = \frac{\text{opposite}}{\text{adjacent}}
In the unit circle, tangent can be understood as the slope of the line through the origin making an angle $$x$$ with the positive x-axis.
For complex numbers, the tangent function is defined using exponentials:
$$ tan(x) = \frac{sin(x)}{cos(x)} = \frac{e^{ix} - e^{-ix}}{i(e^{ix} + e^{-ix})}
This definition extends the tangent function to work beyond real numbers, allowing it to handle complex inputs.