How to calculate PI value with atan() function in Python

2 Answers

0 votes
import math

pi = math.atan(1) * 4

print("pi = ", pi)

'''
run:

pi =  3.141592653589793

'''

 



answered Apr 1, 2016 by avibootz
0 votes
import math

pi = 2 * math.atan(math.inf)

print("pi = ", pi)

'''
run:

pi =  3.141592653589793

'''

 



answered Apr 2, 2016 by avibootz

Related questions

2 answers 334 views
2 answers 410 views
2 answers 400 views
2 answers 447 views
2 answers 414 views
2 answers 610 views
2 answers 437 views
...