Complex Numbers in Python | Set 3 (Trigonometric and Hyperbolic Functions) - GeeksforGeeks

04 Feb, 2020
Some of the Important Complex number functions are discussed in the articles below
Complex Numbers in Python | Set 1 (Introduction)Complex Numbers in Python | Set 2 (Important Functions and constants)
Trigonometric and Hyperbolic Functions are discussed in this article.
Trigonometric Functions
1. sin() : This function returns the sine of the complex number passed in argument.
2. cos() : This function returns the cosine of the complex number passed in argument.
3. tan() : This function returns the tangent of the complex number passed in argument.
# Python code to demonstrate the working of # sin(), cos(), tan()   # importing "cmath" for complex number operationsimport cmath   # Initializing real numbersx = 1.0   y = 1.0  # converting x and y into complex number zz = complex(x,y);  # printing sine of the complex numberprint ("The sine value of complex number is : ",end="")print (cmath.sin(z))  # printing cosine of the complex numberprint ("The cosine value of complex number is : ",end="")print (cmath.cos(z))  # printing tangent of the complex numberprint ("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 arc sine of the complex number passed in argument.
5. acos() : This function returns the arc cosine of the complex number passed in argument.
6. atan() : This function returns the arc tangent of the complex number passed in argument.
# Python code to demonstrate the working of # asin(), acos(), atan()   # importing "cmath" for complex number operationsimport cmath   # Initializing real numbersx = 1.0   y = 1.0  # converting x and y into complex number zz = complex(x,y);  # printing arc sine of the complex numberprint ("The arc sine value of complex number is : ",end="")print (cmath.asin(z))  # printing arc cosine of the complex numberprint ("The arc cosine value of complex number is : ",end="")print (cmath.acos(z))  # printing arc tangent of the complex numberprint ("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.0612750619050357j)
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 argument.
2. cosh() : This function returns the hyperbolic cosine of the complex number passed in argument.
3. tanh() : This function returns the hyperbolic tangent of the complex number passed in argument.
# Python code to demonstrate the working of # sinh(), cosh(), tanh()   # importing "cmath" for complex number operationsimport cmath   # Initializing real numbersx = 1.0   y = 1.0  # converting x and y into complex number zz = complex(x,y);  # printing hyperbolic sine of the complex numberprint ("The hyperbolic sine value of complex number is : ",end="")print (cmath.sinh(z))  # printing hyperbolic cosine of the complex numberprint ("The hyperbolic cosine value of complex number is : ",end="")print (cmath.cosh(z))  # printing hyperbolic tangent of the complex numberprint ("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.2717525853195117j)

4. asinh() : This function returns the inverse hyperbolic sine of the complex number passed in argument.
5. acosh() : This function returns the inverse hyperbolic cosine of the complex number passed in argument.
6. atanh() : This function returns the inverse hyperbolic tangent of the complex number passed in argument.
# Python code to demonstrate the working of # asinh(), acosh(), atanh()   # importing "cmath" for complex number operationsimport cmath   # Initializing real numbersx = 1.0   y = 1.0  # converting x and y into complex number zz = complex(x,y);  # printing inverse hyperbolic sine of the complex numberprint ("The inverse hyperbolic sine value of complex number is : ",end="")print (cmath.asinh(z))  # printing inverse hyperbolic cosine of the complex numberprint ("The inverse hyperbolic cosine value of complex number is : ",end="")print (cmath.acosh(z))  # printing inverse hyperbolic tangent of the complex numberprint ("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 tangent value of complex number is : (0.40235947810852507+1.0172219678978514j)

YouTubeGeeksforGeeks502K subscribersPython Programming Tutorial | Complex Numbers - Part 3 | GeeksforGeeksWatch laterShareCopy linkInfoShoppingTap to unmuteIf playback doesn't begin shortly, try restarting your device.You're signed outVideos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer.CancelConfirmMore videosMore videosSwitch cameraShareInclude playlistAn error occurred while retrieving sharing information. Please try again later.Watch on0:000:000:00 / 2:23•Live•<div class="player-unavailable"><h1 class="message">An error occurred.</h1><div class="submessage"><a href="https://www.youtube.com/watch?v=oC9hmlSgwsw" target="_blank">Try watching this video on www.youtube.com</a>, or enable JavaScript if it is disabled in your browser.</div></div>
This article is contributed by Manjeet Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python String | replace()
Create a Pandas DataFrame from Lists
Python program to convert a list to string
Reading and Writing to text files in Python