Home » Python

math.sinh() method with example in Python

Python math.sinh() method: Here, we are going to learn about the math.sinh() method with example in Python.
Submitted by IncludeHelp, on April 25, 2019

Python math.sinh() method

math.sinh() method is a library method of math module, it is used to get the hyperbolic sine of given number in radians, it accepts a number and returns hyperbolic sine.

Note: math.sinh() method accepts only numbers, if we provide anything else except the number, it returns error TypeError"TypeError: a float is required".

Syntax of math.sinh() method:

    math.sinh(x)

Parameter(s): x – is the number whose hyperbolic sine to be calculated.

Return value: float – it returns a float value that is the hyperbolic sine value of the number x.

Example:

    Input:
    x = 1.5

    # function call
    print(math.sinh(x))

    Output:
    2.1292794550948173

Python code to demonstrate example of math.sinh() method

# Python code to demonstrate example of 
# math.sinh() method

# importing math module
import math 

# number 
x = -10
print("math.sinh(",x,"): ", math.sinh(x))

x = 0
print("math.sinh(",x,"): ", math.sinh(x))

x = 1.5
print("math.sinh(",x,"): ", math.sinh(x))

x = 5
print("math.sinh(",x,"): ", math.sinh(x))

x = 15.45
print("math.sinh(",x,"): ", math.sinh(x))

Output

math.sinh( -10 ):  -11013.232874703393
math.sinh( 0 ):  0.0
math.sinh( 1.5 ):  2.1292794550948173
math.sinh( 5 ):  74.20321057778875
math.sinh( 15.45 ):  2563419.889913433

TypeError example

# Python code to demonstrate example of 
# math.sinh() method with exception

# importing math module
import math 

# number 
x = "2.5"
print("math.sinh(",x,"): ", math.sinh(x))

Output

Traceback (most recent call last):
  File "/home/main.py", line 9, in <module>
    print("math.sinh(",x,"): ", math.sinh(x))
TypeError: a float is required





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.