Go language provides inbuilt support for basic constants and mathematical functions for complex numbers with the help of the cmplx package. You are allowed to find the inverse hyperbolic sine of the specified complex number with the help of Asinh() function provided by the math/cmplx package. So, you need to add a math/cmplx package in your program with the help of the import keyword to access the Asinh() function.
Syntax:
func Asinh(x complex128) complex128
Let us discuss this concept with the help of the given examples:
Example 1:
// Golang program to illustrate how to find the // Inverse Hyperbolic Sine of Complex Number package main import ( "fmt"
"math/cmplx"
) // Main function func main() { // Finding inverse hyperbolic sine of
// the specified complex number
// Using Asinh() function
res_1 := cmplx.Asinh(2 + 5i)
res_2 := cmplx.Asinh(-9 + 8i)
res_3 := cmplx.Asinh(-5 - 7i)
// Displaying the result
fmt.Println( "Result 1:" , res_1)
fmt.Println( "Result 2:" , res_2)
fmt.Println( "Result 3:" , res_3)
} |
Output:
Result 1: (2.37054853731792+1.184231684275022i) Result 2: (-3.1817205225071747+0.7249311476979132i) Result 3: (-2.8440976626506607-0.9473406443130534i)
Example 2:
// Golang program to illustrate how to find // Inverse Hyperbolic Sine of Complex Number package main import ( "fmt"
"math/cmplx"
) // Main function func main() { cnumber_1 := complex(2, 3)
cnumber_2 := complex(6, 8)
// Finding inverse hyperbolic sine
cvalue_1 := cmplx.Asinh(cnumber_1)
cvalue_2 := cmplx.Asinh(cnumber_2)
// Sum of two inverse
// hyperbolic sine values
res := cvalue_1 + cvalue_2
// Displaying results
fmt.Println( "Complex Number 1: " , cnumber_1)
fmt.Println( "Inverse hyperbolic sine 1: " , cvalue_1)
fmt.Println( "Complex Number 2: " , cnumber_2)
fmt.Println( "Inverse hyperbolic sine 2: " , cvalue_2)
fmt.Println( "Sum of inverse hyperbolic sines : " , res)
} |
Output:
Complex Number 1: (2+3i) Inverse hyperbolic sine 1: (1.9686379257930964+0.9646585044076027i) Complex Number 2: (6+8i) Inverse hyperbolic sine 2: (2.995040217583994+0.9248902126310973i) Sum of inverse hyperbolic sines : (4.9636781433770905+1.8895487170387i)
Article Tags :