Esempio n. 1
0
def exp(matrice):
    original_mat = deepcopy(matrice)
    matrice = add_matrices(matrice, basic_mat(matrice))

    for n in range(2, 100):
        matrice = add_matrices(matrice, get_div_mat(original_mat, n))
    return matrice
Esempio n. 2
0
def sinh(matrice):
    result = deepcopy(matrice)

    for n in range(1, 50):
        next_mat = div_matrice(factorial((2 * n) + 1), powering_mat((2 * n + 1), matrice, matrice))
        result = add_matrices(result, next_mat)
    return result
Esempio n. 3
0
def cosh(matrice):
    result = basic_mat(matrice)

    for n in range(1, 50):
        next_mat = div_matrice(factorial(2 * n),
                               powering_mat(2 * n, matrice, matrice))
        result = add_matrices(result, next_mat)
    return result
Esempio n. 4
0
def sin(matrice):
    result = deepcopy(matrice)

    for n in range(1, 50):
        next_mat = div_matrice(factorial(2 * n + 1) , powering_mat(2 * n + 1, matrice, matrice))
        if n % 2 != 0:
            result = sub_matrices(result, next_mat)
        else:
            result = add_matrices(result, next_mat)
    return result