Ejemplo 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
Ejemplo n.º 2
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
Ejemplo n.º 3
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
Ejemplo n.º 4
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
Ejemplo n.º 5
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
Ejemplo n.º 6
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
Ejemplo n.º 7
0
    def execute(self, environment):
        try:
            valores = []
            for p in self.params:
                val = p.execute(environment).value
                if isinstance(val , pd.core.series.Series):
                    val = val.tolist()
                valores.append(val)

            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)
            else:
                value = valores[0]
            if isinstance(value, list):
                if len(value) <= 1:
                    value = value[0]
                    print(value)
                else :
                    value = pd.Series(value)

            return Primitive(TYPE.NUMBER, value, self.row, self.column)
        except TypeError:
            print("Error de tipos")
        except:
            print("Error desconocido")
Ejemplo n.º 8
0
def cosd(column):

    return mt.degrees(cos(column))
Ejemplo n.º 9
0
def atan2d(column1, column2):

    return mt.degrees(atan2(column1, column2))
Ejemplo n.º 10
0
def atand(column):

    return mt.degrees(atan(column))
Ejemplo n.º 11
0
def asind(column):
    return mt.degrees(asin(column))
Ejemplo n.º 12
0
def tand(column):

    return mt.degrees(tan(column))
Ejemplo n.º 13
0
def sind(column):

    return mt.degrees(sin(column))
Ejemplo n.º 14
0
def cotd(column):

    return mt.degrees(cot(column))