# Finding the Inverse Hyperbolic Tangent of Specified Number in Golang

In Golang, the math/cmplx package provides functions to calculate various mathematical operations on complex numbers. The inverse hyperbolic tangent function, also known as arctanh, is one of the many functions provided by the package. Inverse hyperbolic tangent function is used to find the angle whose hyperbolic tangent is a given number. This article explains how to find the inverse hyperbolic tangent of a specified number in Golang.

## Syntax

The syntax to find the inverse hyperbolic tangent of a complex number is as follows −

func Acctanh(x complex128) complex128


## Parameters

The Acctanh() function takes a single parameter, a complex number.

## Return Value

The Acctanh() function returns the inverse hyperbolic tangent of the given complex number.

## Example 1: Find the Inverse Hyperbolic Tangent of a Complex Number

Let's say we want to find the inverse hyperbolic tangent of a complex number (2+3i). Here is the code to find it −

package main

import (
"fmt"
"math/cmplx"
)

func main() {
// Creating a complex number
z := complex(2, 3)

// Finding the inverse hyperbolic tangent of the complex number
actanh := cmplx.Atanh(z)

// Displaying the result
fmt.Println("Inverse Hyperbolic Tangent of", z, "is", actanh)
}


## Output

Inverse Hyperbolic Tangent of (2+3i) is (0.14694666622552977+1.3389725222944935i)


## Example 2: Find the Inverse Hyperbolic Tangent of a Negative Complex Number

Let's say we want to find the inverse hyperbolic tangent of a negative complex number (-4-5i). Here is the code to find it −

package main

import (
"fmt"
"math/cmplx"
)

func main() {
// Creating a complex number
z := complex(-4, -5)

// Finding the inverse hyperbolic tangent of the complex number
atanh := cmplx.Atanh(z)

// Displaying the result
fmt.Println("Inverse Hyperbolic Tangent of", z, "is", atanh)
}


## Output

Inverse Hyperbolic Tangent of (-4-5i) is (-0.09641562020299616-1.4483069952314644i)


## Example 3: Find the Inverse Hyperbolic Tangent of a Zero Complex Number

Let's say we want to find the inverse hyperbolic tangent of a zero complex number (0+0i). Here is the code to find it −

package main

import (
"fmt"
"math/cmplx"
)

func main() {
// Creating a complex number
z := complex(0, 0)

// Finding the inverse hyperbolic tangent of the complex number
atanh := cmplx.Atanh(z)

// Displaying the result
fmt.Println("Inverse Hyperbolic Tangent of", z, "is", atanh)
}


## Output

Inverse Hyperbolic Tangent of (0+0i) is (0+0i)


## Conclusion

Finding the inverse hyperbolic tangent of a specified number in Golang is an easy task using the math/cmplx package's Acctanh() function. It takes a complex number as input and returns the inverse hyperbolic tangent of the number.

Updated on: 17-Apr-2023

55 Views 