# Finding the Hyperbolic Sine of Complex Number in Golang

The hyperbolic sine of a complex number is a mathematical function used in the field of complex analysis. The hyperbolic sine is defined as the sum of the exponential function and the complex conjugate of the exponential function. In Go language, we can find the hyperbolic sine of a complex number using the cmplx.Sin function provided by the standard library.

In this article, we will explore how to find the hyperbolic sine of a complex number in Golang.

## Syntax

The syntax of the cmplx.Sin function is −

func Sin(x complex128) complex128


Here, x is the complex number whose hyperbolic sine needs to be calculated. The return type is also a complex number.

## Example 1: Find Hyperbolic Sine of a Complex Number

Let's start with a simple example of finding the hyperbolic sine of a complex number in Go. Here, we will find the hyperbolic sine of (2+3i) using the cmplx.Sin function.

package main

import (
"fmt"
"math/cmplx"
)

func main() {
x := complex(2, 3)
fmt.Println("sinh(", x, ") =", cmplx.Sinh(x))
}


## Output

sinh( (2+3i) ) = (-3.59056458998578+0.5309210862485197i)


## Example 2: Find Hyperbolic Sine of Another Complex Number

Let's try finding the hyperbolic sine of another complex number in Go. Here, we will find the hyperbolic sine of (4-2i) using the cmplx.Sin function.

package main

import (
"fmt"
"math/cmplx"
)

func main() {
x := complex(4, -2)
fmt.Println("sinh(", x, ") =", cmplx.Sinh(x))
}


## Output

sinh( (4-2i) ) = (-11.356612711218173-24.831305848946375i)


## Example 3: Find Hyperbolic Sine of a Real Number

We can also find the hyperbolic sine of a real number in Go. Here, we will find the hyperbolic sine of 2 using the cmplx.Sin function.

package main

import (
"fmt"
"math/cmplx"
)

func main() {
x := complex(2, 0)
fmt.Println("sinh(", x, ") =", cmplx.Sinh(x))
}


## Output

sinh( (2+0i) ) = (3.626860407847019+0i)


## Conclusion

In this article, we have explored how to find the hyperbolic sine of a complex number in Go. We used the cmplx.Sin function provided by the standard library to calculate the hyperbolic sine of a complex number. We also demonstrated examples of finding the hyperbolic sine of different complex numbers, including real numbers.

Updated on: 12-Apr-2023

72 Views