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 hyperbolic tangent of the specified complex number with the help of Tanh() 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 Tanh() function.
func Tanh(y complex128) complex128
Let us discuss this concept with the help of the given examples:
Example 1 :
Result 1: (1.2407479829240697-0.1861094776473042i) Result 2: (-1.0356479469632376-0.010925884335752532i) Result 3: (-1.16673625724092+0.24345820118572523i)
Example 2 :
Complex Number 1: (0+2i) Hyperbolic tangent 1: (0-2.185039863261519i) Complex Number 2: (4+6i) Hyperbolic tangent 2: (0.9994339325466381-0.0003597965782916252i) Sum : (0.9994339325466381-2.1853996598398107i)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.