这题我一直不知道错在哪里,所以就先记录一下,放着,有空再来看看。
也希望有大佬能提点我一下
def funcos(eps,x ):
s = 1
n = 0
total = 0
while True:
if abs(s) < eps:
break
total += s
n += 2
eveal = 1
for i in range(1,n+1):
eveal *= i
s = (-1**(n//2))*(x**n)/eveal
return total
'''eps=float(input())
x=float(input())
value=funcos(eps,x )
print("cos({0}) = {1:.4f}".format(x,value))'''