mathEasy Examples

Mathematical functions: sqrt, sin, cos, log, factorial, pi, e, inf, nan

Getting started with math

Basic import and usage of the math module.

python
import math

print(f"Pi: {math.pi}")
print(f"E: {math.e}")
print(f"sqrt(16): {math.sqrt(16)}")
print(f"ceil(3.2): {math.ceil(3.2)}")
print(f"floor(3.8): {math.floor(3.8)}")

The math module is part of Python's standard library. Mathematical functions: sqrt, sin, cos, log, factorial, pi, e, inf, nan.

Common math operations

Frequently used functions from the math module.

python
# More math examples
import math

print(f"math module loaded successfully")
print(f"Location: {math.__name__}")
print(f"Has {len(dir(math))} attributes")

These are the most commonly used features of the math module.

Want to try these examples interactively?

Open Easy Playground