Finding Inverse Hyperbolic Sine of Specified Number in Golang


In mathematics, the inverse hyperbolic sine function is also known as the area hyperbolic sine function. It is the inverse function of the hyperbolic sine function, and it is used to find the angle that has a hyperbolic sine equal to a given number. In Golang, we can calculate the inverse hyperbolic sine of a specified number using the math.Asinh() function.

In this article, we will discuss how to find the inverse hyperbolic sine of a specified number in Golang, along with an example.

Using math.Asinh() Function to Find Inverse Hyperbolic Sine

The math.Asinh() function in Golang is used to find the inverse hyperbolic sine of a specified number. The function takes a single argument of type float64 and returns the inverse hyperbolic sine of the number in radians. Here's the syntax for the math.Asinh() function −

func Asinh(x float64) float64

Example: Finding Inverse Hyperbolic Sine of a Number

Let's see an example of how to find the inverse hyperbolic sine of a specified number in Golang −

package main

import (
   "fmt"
   "math"
)

func main() {
   x := 3.0
   inverseHyperbolicSine := math.Asinh(x)

   fmt.Printf("Inverse Hyperbolic Sine of %v is %v", x, inverseHyperbolicSine)
}

Output

Inverse Hyperbolic Sine of 3 is 1.8184464592320668

In the above example, we first declared a variable x and assigned a value of 3 to it. Then, we used the math.Asinh() function to find the inverse hyperbolic sine of the number x. Finally, we printed the result to the console using fmt.Printf().

Here is another example -

Example

package main

import (
   "fmt"
   "math"
)

func main() {
   num := 2.5
   result := math.Asinh(num)

   fmt.Printf("Inverse Hyperbolic Sine of %.2f = %.2f", num, result)
}

Output

Inverse Hyperbolic Sine of 2.50 = 1.65

Conclusion

In summary, the math.Asinh() function in Golang is used to find the inverse hyperbolic sine of a specified number. It takes a single argument of type float64 and returns the inverse hyperbolic sine of the number in radians. We hope this article helped you understand how to find the inverse hyperbolic sine of a specified number in Golang.

Updated on: 12-Apr-2023

61 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements