Esempio n. 1
0
def atan2(column1, column2):
    i = 0
    column1 = mt.convert_num_col(column1)
    column2 = mt.convert_num_col(column2)
    result = list()
    while i < len(column1):
        result.insert(i + 1, math.atan2(column1[i], column2[i]))
        i += 1

    return result
def atan2(column1, column2):
    i = 0
    column1 = mt.convert_num_col(column1)
    column2 = mt.convert_num_col(column2)
    result = list()
    while i < len(column1):
        if (isinstance(column1[i], int) or isinstance(column1[i], float)) and (
                isinstance(column2[i], int) or isinstance(column2[i], float)):
            result.insert(i + 1, math.atan2(column1[i], column2[i]))
        else:
            result.insert(i + 1, column1[i])
        i += 1
    return result
Esempio n. 3
0
def cos(column):
    i = 0
    column = mt.convert_num_col(column)
    result = list()
    while i < len(column):
        result.insert(i + 1, math.cos(column[i]))
        i += 1

    return result
def atan(column):
    i = 0
    column = mt.convert_num_col(column)
    result = list()
    while i < len(column):
        if isinstance(column[i], int) or isinstance(column[i], float):
            result.insert(i + 1, math.atan(column[i]))
        else:
            result.insert(i + 1, column[i])
        i += 1
    return result
Esempio n. 5
0
def cos(column):
    i = 0
    column = mt.convert_num_col(column)
    result = list()
    while i < len(column):
        if isinstance(column[i], int) or isinstance(column[i], float):
            result.append(math.cos(column[i]))
        else:
            result.append(column[i])
        i += 1
    return result
Esempio n. 6
0
def acosh(column):
    i = 0
    column = mt.convert_num_col(column)
    result = list()
    while i < len(column):
        if column[i] >= 1:
            result.insert(i + 1, math.acosh(column[i]))
        else:
            result.insert(i + 1, "Error de dominio")
        i += 1
    return result
Esempio n. 7
0
def tan(column):
    i = 0
    column = mt.convert_num_col(column)
    result = list()
    while i < len(column):
        if (column[i] - (math.pi / 2)) % (math.pi) != 0:
            result.insert(i + 1, math.tan(column[i]))
        else:
            result.insert(i + 1, "Error en el dominio")
        i += 1

    return result
Esempio n. 8
0
def cot(column):
    i = 0
    column = mt.convert_num_col(column)
    result = list()
    while i < len(column):
        if column[i] % math.pi != 0:
            result.insert(i + 1, (math.cos(column[i]) / math.sin(column[i])))
        else:
            result.insert(i + 1, "Error de dominio")
        i += 1

    return result
Esempio n. 9
0
def acos(column):
    i = 0
    column = mt.convert_num_col(column)
    result = list()
    while i < len(column):
        valor = ""
        if column[i] >= -1 and 1 >= column[i]:
            valor = str(math.acos(column[i]))
        else:
            valor = "Error de dominio"
        result.insert(i + 1, valor)
        i += 1

    return result
Esempio n. 10
0
def atanh(column):
    i = 0
    column = mt.convert_num_col(column)
    result = list()
    while i < len(column):
        if isinstance(column[i], int) or isinstance(column[i], float):
            if column[i] < 1 and column[i] > -1:
                result.append(math.atanh(column[i]))
            else:
                result.append("Error de dominio")
                list_errors_tg.append("Error: 22003: la entrada esta fuera del dominio")
        else:
            result.append(column[i])
        i += 1
    return result
Esempio n. 11
0
def tan(column):
    i = 0
    column = mt.convert_num_col(column)
    result = list()
    while i < len(column):
        if isinstance(column[i], int) or isinstance(column[i], float):
            if (column[i] - (math.pi / 2)) % (math.pi) != 0:
                result.append(math.tan(column[i]))
            else:
                result.append("Error de dominio")
                list_errors_tg.append("Error: 22003: la entrada esta fuera del dominio")
        else:
            result.append(column[i])
        i += 1
    return result
def acosh(column):
    i = 0
    column = mt.convert_num_col(column)
    result = list()
    while i < len(column):
        if isinstance(column[i], int) or isinstance(column[i], float):
            if column[i] >= 1:
                result.insert(i + 1, math.acosh(column[i]))
            else:
                result.insert(i + 1, "Error de dominio")
                list_errors.insert(
                    len(list_errors),
                    "Error: 22003: la entrada esta fuera del dominio")
        else:
            result.insert(i + 1, column[i])
        i += 1
    return result
Esempio n. 13
0
def acos(column):
    i = 0
    column = mt.convert_num_col(column)
    result = list()
    while i < len(column):
        if isinstance(column[i], int) or isinstance(column[i], float):
            valor = ""
            if column[i] >= -1 and 1 >= column[i]:
                valor = str(math.acos(column[i]))
            else:
                valor = "Error de dominio"
                list_errors_tg.append("Error: 22003: la entrada esta fuera del dominio")
            result.append(valor)
        else:
            result.append(column[i])
        i += 1

    return result
Esempio n. 14
0
def atand(column):

    return mt.degrees(atan(column))
Esempio n. 15
0
def asind(column):
    return mt.degrees(asin(column))
Esempio n. 16
0
def acosd(column):
    return mt.degrees(acos(column))
Esempio n. 17
0
def tand(column):

    return mt.degrees(tan(column))
Esempio n. 18
0
def atan2d(column1, column2):

    return mt.degrees(atan2(column1, column2))
Esempio n. 19
0
def cotd(column):

    return mt.degrees(cot(column))
Esempio n. 20
0
 def execute(self, environment):
     try:
         valores = []
         types = []
         for p in self.params:
             obj = p.execute(environment)
             val = obj.value
             t = obj.type
             if isinstance(val, pd.core.series.Series):
                 val = val.tolist()
             valores.append(val)
             types.append(t)
         # Se toma en cuenta que las funcines matematicas
         # y trigonometricas producen un tipo NUMBER
         type_ = TYPE.NUMBER
         if self.function == "abs":
             value = mf.absolute(*valores)
         elif self.function == "cbrt":
             value = mf.cbrt(*valores)
         elif self.function == "ceil":
             value = mf.ceil(*valores)
         elif self.function == "ceiling":
             value = mf.ceiling(*valores)
         elif self.function == "degrees":
             value = mf.degrees(*valores)
         elif self.function == "div":
             value = mf.div(*valores)
         elif self.function == "exp":
             value = mf.exp(*valores)
         elif self.function == "factorial":
             value = mf.factorial(*valores)
         elif self.function == "floor":
             value = mf.floor(*valores)
         elif self.function == "gcd":
             value = mf.gcd(*valores)
         elif self.function == "lcm":
             value = mf.lcm(*valores)
         elif self.function == "ln":
             value = mf.ln(*valores)
         elif self.function == "log":
             value = mf.log(*valores)
         elif self.function == "log10":
             value = mf.log10(*valores)
         elif self.function == "mod":
             value = mf.mod(*valores)
         elif self.function == "pi":
             value = mf.pi()
         elif self.function == "power":
             value = mf.pow(*valores)
         elif self.function == "radians":
             value = mf.radians(*valores)
         elif self.function == "round":
             value = mf.round(*valores)
         elif self.function == "sign":
             value = mf.sign(*valores)
         elif self.function == "sqrt":
             value = mf.sqrt(*valores)
         elif self.function == "trunc":
             value = mf.truncate_col(*valores)
         elif self.function == "width_bucket":
             value = mf.with_bucket(*valores)
         elif self.function == "random":
             value = mf.random_()
         elif self.function == "acos":
             value = trf.acos(*valores)
         elif self.function == "acosd":
             value = trf.acosd(*valores)
         elif self.function == "asin":
             value = trf.asin(*valores)
         elif self.function == "asind":
             value = trf.asind(*valores)
         elif self.function == "atan":
             value = trf.atan(*valores)
         elif self.function == "atand":
             value = trf.atand(*valores)
         elif self.function == "atan2":
             value = trf.atan2(*valores)
         elif self.function == "atan2d":
             value = trf.atan2d(*valores)
         elif self.function == "cos":
             value = trf.cos(*valores)
         elif self.function == "cosd":
             value = trf.cosd(*valores)
         elif self.function == "cot":
             value = trf.cot(*valores)
         elif self.function == "cotd":
             value = trf.cotd(*valores)
         elif self.function == "sin":
             value = trf.sin(*valores)
         elif self.function == "sind":
             value = trf.sind(*valores)
         elif self.function == "tan":
             value = trf.tan(*valores)
         elif self.function == "tand":
             value = trf.tand(*valores)
         elif self.function == "sinh":
             value = trf.sinh(*valores)
         elif self.function == "cosh":
             value = trf.cosh(*valores)
         elif self.function == "tanh":
             value = trf.tanh(*valores)
         elif self.function == "asinh":
             value = trf.asinh(*valores)
         elif self.function == "acosh":
             value = trf.acosh(*valores)
         elif self.function == "atanh":
             value = trf.atanh(*valores)
         elif self.function == "length":
             value = strf.length(*valores)
         elif self.function == "substring":
             value = strf.substring(*valores)
         elif self.function == "trim":
             value = strf.trim_(*valores)
         elif self.function == "get_byte":
             value = strf.get_byte(*valores)
         elif self.function == "md5":
             value = strf.md5(*valores)
         elif self.function == "set_byte":
             value = strf.set_byte(*valores)
         elif self.function == "sha256":
             value = strf.sha256(*valores)
         elif self.function == "substr":
             value = strf.substring(*valores)
         elif self.function == "convert_date":
             value = strf.convert_date(*valores)
         elif self.function == "convert_int":
             value = strf.convert_int(*valores)
         elif self.function == "encode":
             value = strf.encode(*valores)
         elif self.function == "decode":
             value = strf.decode(*valores)
         # Se toma en cuenta que la funcion now produce tipo DATE
         elif self.function == "now":
             type_ = TYPE.DATETIME
             value = datetime.now().strftime("%Y/%m/%d %H:%M:%S")
         else:
             # TODO: Agregar un error de funcion desconocida
             value = valores[0]
         if isinstance(value, list):
             if len(value) <= 1:
                 value = value[0]
             else:
                 value = pd.Series(value)
         self.dot()
         return Primitive(type_, value, self.row, self.column)
     except TypeError:
         print("Error de tipos en llamada a funciones")
     except:
         print("Error desconocido")
Esempio n. 21
0
def sind(column):

    return mt.degrees(sin(column))