Untitled

mail@pastecode.io avatar
unknown
python
7 months ago
1.1 kB
1
Indexable
Never
def Mx(max_range=11):
    a = 1.0 / 3.0
    arr = []
    for i in range(max_range):
        result = (
            a * (
                    (-1 * (i + 2) ** 2 - 2 * i - 2)
                    + (1 * (i + 2) ** 2 - 2 * i - 2)
                    + (2 * (i + 2) ** 2 - 2 * i - 2)
                )
            )

        print("Mx * ({}) = {:.6f}".format(i, result))
        arr.append(result)

    return arr


def Rx(mas_of_mx: list, max_range=11):
    a = 0.5
    real_1 = list(range(max_range))
    real_2 = list(range(max_range))
    real_3 = list(range(max_range))

    for i in range(max_range):
        real_1[i] = (-1 * (i + 2) ** 2 - 2 * i - 2) - mas_of_mx[i]
        real_2[i] = (1 * (i + 2) ** 2 - 2 * i - 2) - mas_of_mx[i]
        real_3[i] = (2 * (i + 2) ** 2 - 2 * i - 2) - mas_of_mx[i]

    for i in range(max_range):
        for k in range(max_range):
            res = a * (real_1[i] * real_1[k] + real_2[i] * real_2[k] + real_3[i] * real_3[k])
            print("Rx * ({}, {}) = {:.6f}".format(i, k, res))


masOfMx = Mx()
print()
Rx(masOfMx)
Leave a Comment