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 324 views
2 answers 403 views
2 answers 394 views
2 answers 440 views
2 answers 409 views
2 answers 603 views
2 answers 432 views
...