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 217 views
2 answers 271 views
2 answers 268 views
2 answers 262 views
2 answers 304 views
2 answers 483 views
2 answers 303 views
...