The atanh() function works both for real and complex numbers. For real number, -1 < x < 1. For complex number, the range is -Inf < x < -1 and 1 < x < Inf.

## Hyperbolic Trigonometric Functions

**R cosh(T x)**

The hyperbolic cosine of x (in radians).

**R sinh(T x)**

The hyperbolic sine of x (in radians).

The hyperbolic tangent of x (in radians).

**R acosh(T x)**

It is an inverse hyperbolic cosine (in radians).

**R asinh(T x)**

It is an inverse hyperbolic cosine (in radians).

**R atanh(T x)**

It is an inverse hyperbolic tangent (in radians) of x.

**atanh() Function in R**

To calculate the hyperbolic arctangent in R, use the atanh() function. The atanh(x) returns the inverse hyperbolic tangent of the elements of x when x is a REAL scalar, vector, matrix, or array. The result has the same shape as x.

**Syntax**

`atanh(x)`

**Parameters**

**x:** It is a numeric value, array, or vector.

**Example**

Let’s calculate the atanh value of 1.

`atanh(1)`

**Output**

`[1] Inf`

If you pass the 0 to the atanh() function, it will return 0.

`atanh(0)`

**Output**

`[1] 0`

**Calculate atanh() of complex number**

Define a complex value and pass that value to the atanh() function.

```
d <- 5 + 1i
atanh(d)
```

**Output**

`[1] 0.194426+1.530881i`

**Plot the atanh() function to a graph**

We can use the seq() function to create a series of values and pass that to the plot() function, which will create a line chart.

```
dt <- seq(-1, 1, by = 0.05)
plot(dt, atanh(dt), typ = "l", col = "red")
abline(v = 0, lty = 6, col = "blue")
```

**Output**

**Applying atanh() function to a Vector**

To create a Vector in R, use the c() function. Then pass that vector to the atanh() function.

```
rv <- c(-1, 0.5, 0, 0.5, 1)
atanh(rv)
```

**Output**

`[1] -Inf 0.5493061 0.0000000 0.5493061 Inf`

**Passing a pi to the atanh() function**

The **pi **is an inbuilt constant in R programming, and its value is **3.141593**.

Let’s find the pi constant’s **atanh()** value.

`atanh(pi)`

**Output**

```
[1] NaN
Warning message:
In atanh(pi) : NaNs produced
```

Let’s see another example of pi.

`atanh(pi / 4)`

**Output**

`[1] 1.059306`

That is it for atanh() function in R programming.