📜  Python中的复数 |第 3 组(三角函数和双曲函数)

📅  最后修改于: 2022-05-13 01:55:31.630000             🧑  作者: Mango

Python中的复数 |第 3 组(三角函数和双曲函数)

下面的文章中讨论了一些重要的复数函数

Python中的复数 |第 1 套(介绍)
Python中的复数 |第 2 组(重要函数和常量)

本文讨论了三角函数和双曲函数。

三角函数

1. sin() :此函数返回传入参数的复数的正弦值。

2. cos() :此函数返回传入参数的复数的余弦

3. tan() :此函数返回传入参数的复数的正切

# Python code to demonstrate the working of 
# sin(), cos(), tan()
   
# importing "cmath" for complex number operations
import cmath
   
# Initializing real numbers
x = 1.0
   
y = 1.0
  
# converting x and y into complex number z
z = complex(x,y);
  
# printing sine of the complex number
print ("The sine value of complex number is : ",end="")
print (cmath.sin(z))
  
# printing cosine of the complex number
print ("The cosine value of complex number is : ",end="")
print (cmath.cos(z))
  
# printing tangent of the complex number
print ("The tangent value of complex number is : ",end="")
print (cmath.tan(z))

输出:

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() :此函数返回传入参数的复数的反正弦值。

5. acos() :此函数返回传入参数的复数的反余弦

6. atan() :此函数返回传入参数的复数的反正切

# Python code to demonstrate the working of 
# asin(), acos(), atan()
   
# importing "cmath" for complex number operations
import cmath
   
# Initializing real numbers
x = 1.0
   
y = 1.0
  
# converting x and y into complex number z
z = complex(x,y);
  
# printing arc sine of the complex number
print ("The arc sine value of complex number is : ",end="")
print (cmath.asin(z))
  
# printing arc cosine of the complex number
print ("The arc cosine value of complex number is : ",end="")
print (cmath.acos(z))
  
# printing arc tangent of the complex number
print ("The arc tangent value of complex number is : ",end="")
print (cmath.atan(z))

输出:

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)

双曲函数

1. sinh() :此函数返回传入参数的复数的双曲正弦值。

2. cosh() :此函数返回传入参数的复数的双曲余弦值

3. tanh() :此函数返回传入参数的复数的双曲正切

# Python code to demonstrate the working of 
# sinh(), cosh(), tanh()
   
# importing "cmath" for complex number operations
import cmath
   
# Initializing real numbers
x = 1.0
   
y = 1.0
  
# converting x and y into complex number z
z = complex(x,y);
  
# printing hyperbolic sine of the complex number
print ("The hyperbolic sine value of complex number is : ",end="")
print (cmath.sinh(z))
  
# printing hyperbolic cosine of the complex number
print ("The hyperbolic cosine value of complex number is : ",end="")
print (cmath.cosh(z))
  
# printing hyperbolic tangent of the complex number
print ("The hyperbolic tangent value of complex number is : ",end="")
print (cmath.tanh(z))

输出:

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() :此函数返回传入参数的复数的反双曲正弦值。

5. acosh() :此函数返回传入参数的复数的反双曲余弦值

6. atanh() :此函数返回传入参数的复数的反双曲正切值。

# Python code to demonstrate the working of 
# asinh(), acosh(), atanh()
   
# importing "cmath" for complex number operations
import cmath
   
# Initializing real numbers
x = 1.0
   
y = 1.0
  
# converting x and y into complex number z
z = complex(x,y);
  
# printing inverse hyperbolic sine of the complex number
print ("The inverse hyperbolic sine value of complex number is : ",end="")
print (cmath.asinh(z))
  
# printing inverse hyperbolic cosine of the complex number
print ("The inverse hyperbolic cosine value of complex number is : ",end="")
print (cmath.acosh(z))
  
# printing inverse hyperbolic tangent of the complex number
print ("The inverse hyperbolic tangent value of complex number is : ",end="")
print (cmath.atanh(z))

输出:

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)