Advertisement
matisarnowski

compute.py

Feb 19th, 2023
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. from my_tkinter import *
  2.  
  3.  
  4. class LinearEquations:
  5.  
  6.     def __init__(self, a1, b1, c1, a2, b2, c2):
  7.         self.a1 = a1
  8.         self.b1 = b1
  9.         self.c1 = c1
  10.         self.a2 = a2
  11.         self.b2 = b2
  12.         self.c2 = c2
  13.  
  14.     def is_compute(self):
  15.         w = self.a1 * self.b2 - self.a2 * self.b1
  16.         if w != 0:
  17.             return True
  18.         else:
  19.             return False
  20.  
  21.     def equal_equations_linear(self):
  22.         w = self.a1 * self.b2 - self.a2 * self.b1
  23.         if w != 0:
  24.             return tuple([(self.c1 * self.b2 - self.b1 * self.c2) / w,
  25.                           (self.c2 * self.a1 - self.a2 * self.c1) / w])
  26.         else:
  27.             return tuple("Układ równań nie ma rozwiązań.",
  28.                          "Proste są do siebie równoległe")
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement