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 331 views
2 answers 408 views
2 answers 398 views
2 answers 446 views
2 answers 414 views
2 answers 607 views
2 answers 436 views
...