tan_value =math.tan(math.radians(angle))print("角度为", angle,"度的正切值为", tan_value) 同样地,我们先将角度转换为弧度,然后调用math.tan函数计算正切值。 总结 在Python中进行三角函数的运算非常简单。我们只需要导入math库,并使用其中的sin、cos和tan函数即可。通过这些函数,我们可以轻松地计算任意角度...
y1 = np.cos(x) y2 = 1 - 1 / 2 * x ** 2 y3 = 1 - 1 / 2 * x ** 2 + 1 / 24 * x ** 4 # 设置标题和图表 plt.title("$y = cos(x) ≈ 1 - 1/2*x^2 ≈ 1 - 1/2*x^2 + 1/24*x^4$") plt.plot(x, y1, label='$cos(x)$') plt.plot(x, y2, label='...