Constants of Maths in Python Last Updated : 17 May, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report Math module is a standard in-built module in Python that can be used for performing the mathematical tasks. The math module has a set of methods and constants. Note: For more information, refer to Math-library-functions 1. Python math.e constant: The math.e constant returns the Euler's number: 2.71828182846. Syntax: math.e Returns: Return a float value, 2.71828182846, representing the mathematical constant e Example: Python3 # Import math Library import math # Print the value of Euler e print (math.e) Output: 2.718281828459045 2. Python math.pi constant: The math.pi constant returns the value pi: 3.14159265359. It is defined as the ratio of the circumference to the diameter of a circle. Syntax: math.pi Returns: A float value, 3.14159265359, representing the mathematical constant PI Example: Python3 # Import math Library import math # Print the value of pi print (math.pi) Output: 3.141592653589793 3. Python math.tau constant: The math.tau constant returns the value tau: 6.283185307179586. It is defined as the ratio of the circumference to the radius of a circle. Syntax: math.tau Returns: A float value, 6.283185307179586, representing the mathematical constant tau Example: Python3 # Import math Library import math # Print the value of tau print (math.tau) Output: 6.283185307179586 4. Python math.inf constant: The math.inf constant returns of positive infinity. For negative infinity, use -math.inf.The inf constant is equivalent to float("inf"). Syntax: math.inf Returns: A float value, returns the value of positive infinity. Example: Python3 # Import math Library import math # Print the positive infinity print (math.inf) # Print the negative infinity print (-math.inf) Output: inf -inf 5. Python math.nan constant: The math.nan constant returns a floating-point nan (Not a Number) value. This value is not a legal number.The nan constant is equivalent to float("nan"). Syntax: math.nan Returns: A float value, nan (Not a Number) Example: Python3 # Import math Library import math # Print the value of nan print (math.nan) Output: nan Comment More infoAdvertise with us Next Article Constants of Maths in Python _gurusingh Follow Improve Article Tags : Python Computer Subject Programming Language Write From Home Python math-library Python math-library-functions +2 More Practice Tags : python Similar Reads math.cos() in Python math.cos() function in Python is part of the built-in math module, which provides access to mathematical functions. The math.cos() function is used to calculate the cosine of an angle, which is a fundamental trigonometric function widely used in various fields like physics, engineering and computer 2 min read Python | sympy.is_constant() method With the help of sympy.is_constant() method, we can check if element is constant or not and it will return a boolean value if found constant by using sympy.is_constant() method. Syntax : sympy.is_constant() Return : Return a boolean value if constant is found. Example #1 : In this example we can see 1 min read Python Constant In Python, constants are variables whose values are intended to remain unchanged throughout a program. They are typically defined using uppercase letters to signify their fixed nature, often with words separated by underscores (e.g., MAX_LIMIT). Let's understand with the help of example:Python # Mat 2 min read How to create constant in Python Python lacks built-in constant support, but constants are typically represented using all-uppercase names by convention. Although they can technically be reassigned, itâs best practice to avoid modifying their values. This convention helps indicate that such variables should remain unchanged through 2 min read Python math function | copysign() math.copysign() is a function exists in Standard math Library of Python. This function returns a float value consisting of magnitude from parameter x and the sign (+ve or -ve) from parameter y. Syntax : math.copysign(x, y) Parameters : x : Integer value to be converted y : Integer whose sign is requ 1 min read Like