# atanh in R: How to Use atanh() Function in R

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

The hyperbolic sine of x (in radians).

The hyperbolic tangent of x (in radians).

It is an inverse hyperbolic cosine (in radians).

It is an inverse hyperbolic cosine (in radians).

R atanh(T x)

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

## atanh in R

The atanh() is a built-in R function that returns the inverse hyperbolic tangent. It accepts the vector, scalar, matrix, or array and returns the hyperbolic tangent of the provided object.

To calculate the hyperbolic arctangent in R, use the atanh() function. For example, 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

`` Inf``

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

``atanh(0)``

#### Output

`` 0``

## Calculating atanh() of complex number

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

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

#### Output

`` 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

`` -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

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

Let’s see another example of pi.

``atanh(pi / 4)``

#### Output

`` 1.059306``

That is it for the atanh() function overview.