I have been working on this; It is a formula for estimating pi.
My problem is that I am getting values no where near 3.14; all of my pi results are even coming out negative, and around -.000003, etc..
Can you see where i made my mistake in the structure of the math?
The formula is as follows:
Sigma from K=0 > inf.
2( -1^k ) * 3^[ (1/2) - k ]
/
2(k)+1
My problem is that I am getting values no where near 3.14; all of my pi results are even coming out negative, and around -.000003, etc..
Can you see where i made my mistake in the structure of the math?
The formula is as follows:
Sigma from K=0 > inf.
2( -1^k ) * 3^[ (1/2) - k ]
/
2(k)+1
Code:
for k in range(0, 55, 5):
pi = ( ( 2 * ( - 1 ** k ) ) * ( 3 ** ( ( 1 / 2 ) - k ) ) / ( 2 * k + 1 ) )
print("After ", k, "terms, the approximation of pi is ", "%.3f" % pi)
Comment