c(t)=e^(I*t)# parametrize the unit circle. c(t):[0,2pi]
start=0stop=2*float(pi)N=1000
line_points=srange(float(start),float(stop),(stop-start)/N,include_endpoint=True)#N+1 points on [start, stop] z=map(c,line_points)#N+1 points on curve #The points are denoted z[0], z[1], ..., z[N]
sum(f(z[i])*(z[i+1]-z[i])foriinrange(0,N-1))# approximate integral of z^2
-9.86918230106e-05 - 0.00628239983217*I
dc(t)=c.diff(t)# derivative of c(t)answer=integrate(f(c(t))*dc(t),(t,start,stop))# integrate using parametrization answer
-2.44929359829e-16*I
float(answer.real_part())+float(answer.imag_part())*I# check if answer from parametrization agrees with approximation by taking its floating-point value
-2.44929359829e-16*I
# As we can see based on our solutions, the approximation formula and parameterization solutions are approximately "0"