carmi1909@ciencias.unam.mx

conicas
 avatar
Carmi
plain_text
2 years ago
1.7 kB
2
Indexable
Never
class conicas:
    def __init__(self, variables):
        #Ax2^ + Bxy + Cy^2 + Dx + Ey + F
        self.set_a(variables[0])
        self.set_b(variables[1])
        self.set_c(variables[2])
        self.set_d(variables[3])
        self.set_e(variables[4])
        self.set_f(variables[5])
    def set_a(self, xcuadrada):
        self.__a = xcuadrada
    def set_b(self, mixto):
        self.__b = mixto
    def set_c(self, ycuadrada):
        self.__c = ycuadrada
    def set_d(self, x):
        self.__d = x
    def set_e(self, y):
        self.__e = y
    def set_f(self, independiente):
        self.__f = independiente
    def get_a(self):
        return self.__a
    def get_b(self):
        return self.__b
    def get_c(self):
        return self.__c
    def get_d(self):
        return self.__d
    def get_e(self):
        return self.__e
    def get_f(self):
        return self.__f
    def __str__(self):
        return str(self.get_a()) + "x^2 + " + str(self.get_b()) + "xy + " + str(self.get_c()) + "y^2 + " + str(self.get_d()) + "x + " + str(self.get_e()) + "y + " + str(self.get_f())
    def __call__(self):
        if self.get_a() == self.get_c():
            return "circunferencia"
        if self.get_a() == 0 or self.get_c() == 0:
            return "parabola"
        if self.get_a() > 0 and self.get_c() > 0:
            return "elipse"
        if self.get_a() < 0 and self.get_c() < 0:
            return "elipse"
        if self.get_a() > 0 and self.get_c() < 0:
            return "hipérbola"
        if self.get_a() < 0 and self.get_c() > 0:
            return "hipérbola"

from fc.matematicas.conicas import conicas
c1 = conicas([1,2,3,4,5,6])
print(c1)
print(c1())