my teacher gave this assignment asking to estimate pi at different values of "i". i can get the first value of 4.0000 just fine but when i try for 101 i get 0.5024. Im honestly drawing a total blank here and the other questions on this site use a slightly different equation for estimation
here's my code:
num = 1
def m(i):
answer = 0
for k in range(num):
answer+=((-1)**(i+1)/(2*i-1))
return answer
and the question:
m(i) = 4*(1-1/3+1/5-1/7+1/9-1/11+⋯+〖(-1)〗^(i+1)/(2*i-1))
Your task: Write a function that returns m(i) for a given i and write a test program that displays the following table
i m(i)
1 4.0000
101 3.1515
201 3.1466
301 3.1449
401 3.1441
501 3.1436
601 3.1433
701 3.1430
801 3.1428
901 3.1427
any help is appreciated and please excuse my inability to format on here (i'm new)