-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.py
More file actions
67 lines (55 loc) · 1.78 KB
/
Copy pathMain.py
File metadata and controls
67 lines (55 loc) · 1.78 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python
import os
def main():
try:
#Comment the following lines if not in windows
print("Definicion de la Matriz")
print("Ingrese los valores: ")
print("|x1 y1 z1 r1|")
print("|x2 y2 z2 r2|")
print("|x3 y3 z3 r3|")
x1 = float(input('Ingrese el valor x1: \n>>'))
y1 = float(input('Ingrese el valor y1: \n>>'))
z1 = float(input('Ingrese el valor z1: \n>>'))
r1 = float(input('Ingrese el valor r1: \n>>'))
x2 = float(input('Ingrese el valor x2: \n>>'))
y2 = float(input('Ingrese el valor y2: \n>>'))
z2 = float(input('Ingrese el valor z2: \n>>'))
r2 = float(input('Ingrese el valor r2: \n>>'))
x3 = float(input('Ingrese el valor x3: \n>>'))
y3 = float(input('Ingrese el valor y3: \n>>'))
z3 = float(input('Ingrese el valor z3: \n>>'))
r3 = float(input('Ingrese el valor r3: \n>>'))
#Determinante del Sistema
DetSys = ((x1*y2*z3)+(x2*y3*z1)+(x3*y1*z2))-((x3*y2*z1)+(z2*y3*x1)+(z3*y1*x2))
#print(DetSys)
#Determinante de X
DetX = ((r1*y2*z3)+(r2*y3*z1)+(r3*y1*z2))-((r3*y2*z1)+(z2*y3*r1)+(z3*y1*r2))
#print(DetX)
#Determinante de Y
DetY = ((x1*r2*z3)+(x2*r3*z1)+(x3*r1*z2))-((x3*r2*z1)+(z2*r3*x1)+(z3*r1*x2))
#print(DetY)
#Determinante de Z
DetZ = ((x1*y2*r3)+(x2*y3*r1)+(x3*y1*r2))-((x3*y2*r1)+(r2*y3*x1)+(r3*y1*x2))
#print(DetZ)
#Obtencion de las incognitas
X= DetX/DetSys
Y= DetY/DetSys
Z= DetZ/DetSys
print("Los resultados son: ", "\nX=",X,"\nY=",Y,"\nZ=",Z)
rep = str(input("Quieres repetir la operacion?(S/n): \n>>"))
if rep.upper() == "S":
main()
elif rep.upper() == "N":
exit()
else:
print("Not a real option, exiting!")
exit()
#Handle Keyboard Interrupt error
except KeyboardInterrupt as ManualExit:
#Change to "clear" if in linux or IOS
exit()
finally:
exit()
if __name__=="__main__":
main()