我想使用泰勒级数求解 arctan (x),但我的代码不起作用。我该如何解决这个问题?
#!usr/bin/python
from numpy import *
def err(string):
print string
raw_input ('Press Enter to Exit')
sys.exit()
def postive_term(x)
sum_i = 0.0
for i in range(50):
Y(i) = 1**((4.0*i)+1.0)/((4.0*i)+1.0)
sum_i = Y(i)
return sum_i
def negatif_term(x)
sum_j = 0.0
for j in range(50):
S(j) = 1**((4.0*j)+3.0)/((4.0*j)+3.0)
sum_j = S(j)
return sum_j
u(i) = sum_i - sum_j
print 'result Tan^{-1} (x)=', u(i)`