用Python的import写出三种方法计算arctanπ4
- 第一种方法:使用math库中的atan函数
import math
x = math.atan(math.pi/4)
print(x)
输出结果:0.6657737500283538
- 第二种方法:使用numpy库中的arctan函数
import numpy as np
x = np.arctan(np.pi/4)
print(x)
输出结果:0.6657737500283538
- 第三种方法:使用cmath库中的arctan函数(用于复数的计算)
import cmath
x = cmath.atan(cmath.pi/4)
print(x)
输出结果:(0.6657737500283538+0j)
原文地址: https://www.cveoy.top/t/topic/bjkH 著作权归作者所有。请勿转载和采集!