Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
suyashi29
GitHub Repository: suyashi29/python-su
Path: blob/master/Python Basics/Mathematical Analysis in Python.ipynb
3074 views
Kernel: Python 3
round(234000.66543, 3)
234000.665
x = min(-14, 10.2, 20) y = max(-14, 10.2, 20) print(x) print(y)
-14 20

The abs() function returns the absolute (positive) value of the specified number

abs(-89.9922)
89.9922
a=pow(8,20) a
1152921504606846976
import math as m
k = m.sqrt(256) k
16.0

The math.ceil() method rounds a number upwards to its nearest integer, and the math.floor() method rounds a number downwards to its nearest integer, and returns the result

import math x = math.ceil(4.7) y = math.floor(4.7) print(x) # returns 5 print(y) # returns 4
5 4
p = math.pi p
3.141592653589793

Math methods

image.png

image.png

import math x=int(input("Enter any number =")) math.factorial(x) math.exp(x) math.pow(x,4) math.acosh(x) math.pi math.radians(60) math.sin(1.04719) math.log(100) math.log10(100) math.sqrt(x) round(math.sqrt(x),3)
Enter any number =23
4.796
import math as m m.pow(3,2)
9.0
math.fsum((1,2,3,4))
10.0
math.factorial(8)
40320
math.log(10,2) # (num,base)
3.3219280948873626
math.exp(8)
2980.9579870417283