Use Python for the program ll SolutionPlease run this in pyt

Use Python for the program!

ll

Solution

Please run this in python 2.7

import math

def an(n):
t1=4.0/(8*n+1)
t2=2.0/(8*n+4)
t3=1.0/(8*n+5)
t4=1.0/(8*n+6)
return t1-t2-t3-t4

def pi_star_n(n):
temp=0.0
for i in range(0,n+1):
temp+=an(i)*(math.pow(16,-1*i))
return temp

def main():
n=100
while((0.06666667*an(n+1)*(math.pow(0.0625,n)))<=(0.5*(math.pow(10,-12)))):
n-=1;
print(\"Smallest integer value of n is: \",n)
print(\"Pi star value of n is: \",pi_star_n(9))

main()

Use Python for the program! ll SolutionPlease run this in python 2.7 import math def an(n): t1=4.0/(8*n+1) t2=2.0/(8*n+4) t3=1.0/(8*n+5) t4=1.0/(8*n+6) return t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site