Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
suyashi29
GitHub Repository: suyashi29/python-su
Path: blob/master/Data Science using Python/Day 1 Mathematical Analysis in Python.ipynb
3074 views
Kernel: Python 3 (ipykernel)
import math

Math methods

image.png

image.png

help()

import math print(math.exp(3))
20.085536923187668
import math as mt mt.radians(90)
1.5707963267948966
import math x=int(input("Enter any number =")) print(math.factorial(x)) print(math.exp(x)) print(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)
import math as mt mt.pow(3,2)
9.0
mt.fsum((1,2,3,4))
10.0
mt.factorial(8)
40320
a=math.log(10,2) # (num,base) a
3.3219280948873626
a=round(a, 2) a
3.32
x = min(-14, 10.2, 20) y = max(-14, 10.2, 20) print(x) print(y)
-14 20
abs(-89.9922) #he abs() function returns the absolute (positive) value of the specified number
89.9922

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(9.85) y = math.floor(9.85) print(x) print(y)
10 9
p = math.pi p
3.141592653589793
x=3.5 eval ("x*x*x-2*x*x+9*x+3")
52.875