-
Notifications
You must be signed in to change notification settings - Fork 0
/
Base.py
33 lines (25 loc) · 838 Bytes
/
Base.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import math
def sum(NUM1,NUM2):
res = (NUM1[0]+NUM2[0],NUM1[1]+NUM2[1])
return res
def res(NUM1,NUM2):
res = (NUM1[0]-NUM2[0],NUM1[1]-NUM2[1])
return res
def pro(NUM1,NUM2):
res = (NUM1[0]*NUM2[0]-NUM1[1]*NUM2[1],NUM1[0]*NUM2[1]+NUM2[0]*NUM1[1])
return res
def div(NUM1,NUM2):
res = ((((NUM1[0]*NUM2[0])+(NUM1[1]*NUM2[1]))/(NUM2[0]**2+NUM2[1]**2)),(((NUM2[0]*NUM1[1])-(NUM1[0]*NUM2[1]))/(NUM2[0]**2+NUM2[1]**2)))
return res
def mod(NUM1):
res = math.sqrt(NUM1[0]**2+NUM1[1]**2)
return res
def conj(NUM1):
res = (NUM1[0],(-1)*NUM1[1])
return res
def ctop(NUM1):
res = (round(math.sqrt(NUM1[0]**2+NUM1[1]**2),2),round(math.atan(NUM1[1]/NUM1[0])*180/math.pi,2))
return res
def fase(NUM1):
res = round(math.atan(NUM1[1]/NUM1[0])*180/math.pi,2)
return "{}°".format(res)