How to calculate the hyperbolic tangent of a number in Python

1 Answer

0 votes
import math

print("math.tanh(1) = ", math.tanh(1))
print("math.tanh(-1) = ", math.tanh(-1))
print("math.tanh(0.0) = ", math.tanh(0.0))
print("math.tanh(-0.0) = ", math.tanh(-0.0))
print("math.tanh(math.log(2.0)) = ", math.tanh(math.log(2.0)))


'''
run:

math.tanh(1) =  0.7615941559557649
math.tanh(-1) =  -0.7615941559557649
math.tanh(0.0) =  0.0
math.tanh(-0.0) =  -0.0
math.tanh(math.log(2.0)) =  0.6

'''

 



answered Oct 20, 2017 by avibootz

Related questions

1 answer 172 views
1 answer 136 views
3 answers 143 views
1 answer 162 views
...