About 59,700 results
Open links in new tab
  1. python - Is there a difference between scipy.pi, numpy.pi, or …

    Sep 8, 2023 · That said, if you're not already using numpy or scipy, importing them just for np.pi or scipy.pi would add unnecessary dependency while math is a Python standard library, so …

  2. python - Print pi to a number of decimal places - Stack Overflow

    Mar 6, 2019 · But this still limits n to be less than the len(str(math.pi)), less than 15 in Python 2. Given a serious n, it breaks: > python test.py Enter the number of decimal places you want to …

  3. math - How can I convert radians to degrees with Python ... - Stack ...

    Mar 26, 2012 · @lucase.62, Mark is correct. The cos function operates on an angle as the input, 1 in your example. On your calculator, this angle is in degress, in Python, this angle must be …

  4. Using PI in python 2.7 - Stack Overflow

    Jan 8, 2016 · I am trying to access the value of pi in Python 2.7, but it seems as if Python doesn't recognize math.pi. I am using IDLE, and when I try to print the value of math.pi, it says that …

  5. math - Is the golden ratio defined in Python? - Stack Overflow

    Aug 8, 2014 · The python math docs says math.pi is "The mathematical constant π = 3.141592..., to available precision". However, you may calculate four times the arc tangent of one and get …

  6. python 2.7 - Sin pi : give wrong result - Stack Overflow

    Oct 16, 2017 · i tried to create polar array with math module ; but math.sin(math.pi) always give wrong result. with python 2.7 or 3.5 the same wrong result : import math m = …

  7. floating point - Python precision of math.pi - Stack Overflow

    Jul 25, 2014 · >>> math.tan(math.pi/4) - 1 -1.1102230246251565e-16 and is just accumulated through all the floating point operations involved in dividing by four and taking the tan of an …

  8. Python - Writing a function to calculate and return the area of a ...

    Jan 10, 2014 · It is that line that tries to access the global name PI, which is not defined. However, the line is not needed at all here. Your function itself is fine, apart from not quite calculating the …

  9. python - NameError: name 'PI' is not defined? - Stack Overflow

    Google "Python. eval is evil" for details. In contexts like this it doesn't really make a difference, but it is a bad habit to reach for eval when confronted with a parsing problem. – John Coleman

  10. python - ModuleNotFoundError: No module named 'math

    Jul 26, 2019 · Incompatible Source Code: Python 3.7.1 was released in 2018, and since then, system libraries on Arch Linux (such as glibc) and compiler versions have evolved. The …