 # Complex Numbers in Python | Set 3 (trigonometric and hyperbolic functions)

Trigonometric functions

1. sin () : This function returns the sine of the complex number passed in the argument.

2. cos () : This function returns the cosine of the complex number passed in the argument.

3. tan () : This function returns the tangent of the complex number passed in the argument.

` `

``` # Python code for demonstration work # sin (), cos (), tan ()   # import & quot; cmath & quot; for operations with complex numbers import cmath   # Initializing real numbers x = 1.0   y = 1.0   # convert x and y to complex z z = complex (x, y);    # printing the sine of a complex number print ( "The sine value of complex number is:" , end = "") print (cmath.sin (z))   # printing the cosine of a complex number print ( "The cosine value of complex number is:" , end = "") print (cmath .cos (z))   # complex number print tangent print ( "The tangent value of complex number is: " , end = " ") print (cmath.tan (z)) ```

` `

Output:

` The sine value of complex number is: (1.2984575814159773 + 0.6349639147847361j) The cosine value of complex number is: (0.8337300251311491-0.9888977057628651j) The tangent value of complex number is: (0.2717525853195118 + 1.0839233273386946j) `

4. asin () : This function returns the arcsine of the complex number passed in the argument.

5. acos () : This function returns the inverse cosine of the complex number passed in the argument.

6. atan () : This function returns the arctangent of the complex number passed in the argument.

` `

``` # Python code for demonstration work # asin (), acos (), atan ()   # import & quot; cmath & quot; for operations with complex numbers import cmath   # Initializing real numbers x = 1.0   y = 1.0   # convert x and y to complex z z = complex (x, y);    # printing the sine arc of a complex number print ( "The arc sine value of complex number is:" , end = "") print (cmath.asin (z))   # printing the arccosine of a complex number print ( " The arc cosine value of complex number is: " , end = " ") print (cmath.acos (z))   # print arctangent comp lex number print ( "The arc tangent value of complex number is: " , end = " ") print (cmath.atan (z)) ```

` `

Output:

` The arc sine value of complex number is: (0.6662394324925153 + 1.0612750619050357 j) The arc cosine value of complex number is: (0.9045568943023814-1.0612750619050357j) The arc tangent value of complex number is: (1.0172219678978514 + 0.40235947810852507j) `

Hyperbolic functions

1. sinh () : This function returns the hyperbolic sine of the complex number passed in the argument.

2. cosh () : This function returns the hyperbolic cosine of the complex number passed in the argument.

3. tanh () : This function returns the hyperbolic tangent of the complex number passed in the argument.

` `

``` # Python code for demonstrations # sinh (), cosh (), tanh ()   # import & quot; cmath & quot; for operations with complex numbers import cmath   # Initializing real numbers x = 1.0   y = 1.0   # convert x and y to complex z z = complex (x, y);    # printing the hyperbolic sine of a complex number print ( "The hyperbolic sine value of complex number is:" , end = "") print (cmath.sinh (z))   # printing the hyperbolic cosine of a complex number print ( "The hyperbolic cosine value of complex number is:" , end = "") print (cmath.cosh (z))    # printing the hyperbolic tangent of a complex number print ( "The hyperbolic tangent value of complex number is:" , end = "") print (cmath.tanh (z)) ```

Output:

``` The hyperbolic sine value of complex number is: (0.6349639147847361 + 1.2984575814159773j) The hyperbolic cosine value of complex number is: (0.8337300251311491 + 0.9888977057628651j) The hyperbolic tangent value of complex number is: (1.0839233273386946 + 0.2711725853195 p>  4. asinh () : This function returns the  inverse hyperbolic sine  of the complex number passed in the argument.    5. acosh () : This function returns the  inverse hyperbolic cosine  of the complex number passed in the argument.    6. atanh () : This function returns the  inverse hyperbolic tangent  of the complex number passed in the argument.      `  `     ` # Python code to demonstrate how it works `  ` # asinh (), acosh (), atanh () `   ` `  ` # import & quot; cmath & quot; for operations with complex numbers `   ` import ` ` cmath `    ` # Initializing real numbers `   ` x ` ` = ` ` 1.0 `      ` y ` ` = ` ` 1.0 `     ` # convert x and y to complex z `   ` z ` ` = ` ` complex ` ` (x, y); `    ` # print the inverse hyperbolic sine of a complex number `   ` print ` ` (` ` "The inverse hyperbolic sine value of complex number is:" ` `, end ` ` = ` ` "") `   ` print ` ` (cmath.asinh (z)) `    ` # print the inverse hyperbolic cosine of a complex number `   ` print ` ` (` ` "The inverse hyperbolic cosine value of complex number is:" ` `, end ` ` = ` ` "") `  ` print ` ` (cmath.acosh (z)) `  ` `  ` # print the inverse hyperbolic tangent of a complex number `   ` print   (  "The inverse hyperbolic tangent value of complex number is:"  , end   =   "") ``   print   (cmath.atanh (z)) `` `   Output:   The inverse hyperbolic sine value of complex number is: (1.0612750619050357 + 0.6662394324925153j) The inverse hyperbolic cosine value of complex number is: (1.0612750619050357 + 0.9045568943023813j) The inverse hyperbolic tangolic of complex number is: (0.40235947810852507 + 1.0172219678978514j)
This article courtesy of   Manjit Singh  . If you are as Python.Engineering and would like to contribute, you can also write an article using  contribute.python.engineering  or by posting an article contribute @ python.engineering. See my article appearing on the Python.Engineering homepage and help other geeks.