Example #1
0
def M2(H0, W, v, start, stop, step):
    v0 = 93536.7
    n = 10.3

    print('H0: ', H0)
    print('W: ', W)
    print('v:', v)
    print('start=', start, ' end=', stop, ' step=', step)

    def f_prof(t):
        return v0 * np.exp(-1 * n * t)

    section = np.linspace(start,
                          stop,
                          num=int((stop - start) // step),
                          endpoint=False)

    Y = v
    for i, t in enumerate(section):
        print("---------", i, "---------", t, "----------")
        A = -step * (H0 + f_prof(t + step / 2) * W)

        Y = exp(A, Y, -1.0)
        print_more_info(Y)

    return Y
Example #2
0
def Cf4(H0, W, v, step):
    v0 = 93536.7
    n = 10.3

    def f_prof(t):
        return v0 * np.exp(-1 * n * t)

    section = np.arange(0, 1 + step, step)
    Y = v
    c1 = 0.5 - np.sqrt(3) / 6
    c2 = 0.5 + np.sqrt(3) / 6
    alfa1 = (3 - 2 * np.sqrt(3)) / 12
    alfa2 = (3 + 2 * np.sqrt(3)) / 12
    for i, t in enumerate(section):
        # print('-'*10, f' {i} ', '-'*10,)
        A1 = H0 + f_prof(t + c1 * step) * W
        A2 = H0 + f_prof(t + c2 * step) * W
        omega = 123  #???????????????????
        Y = exp(omega, Y, 1)
        # print(Y)
        # print('norm ', la.norm(Y))

    # print('-'*10, ' final ', '-'*10,)
    # print(1Y)
    return Y
Example #3
0
def M4(H0, W, v, start, stop, step):
    v0 = 93536.7
    n = 10.3

    def f_prof(t):
        return v0 * np.exp(-1 * n * t)

    def commutator(A1, A2):
        return A1.dot(A2) - A2.dot(A1)

    section = np.linspace(start,
                          stop,
                          num=int((stop - start) // step),
                          endpoint=False)
    Y = v
    c1 = 0.5 - np.sqrt(3) / 6
    c2 = 0.5 + np.sqrt(3) / 6
    for i, t in enumerate(section):
        print("---------", i, "---------", t, "----------")
        A1 = H0 + f_prof(t + c1 * step) * W
        A2 = H0 + f_prof(t + c2 * step) * W
        omega = -step / 2 * (A1 + A2) + 1j * (np.sqrt(3) / 12 *
                                              step**2) * commutator(A2, A1)
        Y = exp(omega, Y, 1.0)
        #print(Y)
        #print('norm ', 1-la.norm(Y))

    #print('-'*10, ' final ', '-'*10,)
    #print(Y)
    return Y
Example #4
0
def M6(H0, W, v, start, stop, step):
    v0 = 93536.7
    n = 10.3

    def f_prof(t):
        return v0 * np.exp(-1 * n * t)

    def commutator(A1, A2):
        return A1.dot(A2) - A2.dot(A1)

    section = np.linspace(start,
                          stop,
                          num=int((stop - start) // step),
                          endpoint=False)
    Y = v
    c1 = 0.5 - np.sqrt(15) / 10
    c2 = 0.5
    c3 = 0.5 + np.sqrt(15) / 10
    for i, t in enumerate(section):
        #print('-'*10, f' {i} ', '-'*10,)
        A1 = H0 + f_prof(t + c1 * step) * W
        A2 = H0 + f_prof(t + c2 * step) * W
        A3 = H0 + f_prof(t + c3 * step) * W
        B1 = step * A2
        B2 = (np.sqrt(15) * step / 3) * (A3 - A1)
        B3 = (10 * step / 3) * (A3 - 2 * A2 + A1)
        omega = B1 + 0.5 * B3 + 1 / 240 * commutator(
            -20 * B1 - B3 + commutator(B1, B2),
            B2 - 1 / 60 * commutator(B1, 2 * B3 + commutator(B1, B2)))
        Y = exp(omega, Y, 1.0)
        #print(Y)
        #print('norm ', la.norm(Y))

    #print('-'*10, ' final ', '-'*10,)
    #print(Y)
    return Y
Example #5
0
#         (np.cosh(1.0) + A2*np.sinh(1)).dot(v2)
# print('A2 v2: ', delta)
#
# delta = exp(A2, leja_points, div_diff, v=v3) -\
#         (np.cosh(1.0) + A2*np.sinh(1)).dot(v3)
# print('A2 v3: ', delta)
# print('--------------')
#
#
# # --- Third mtrx ---
# delta = exp(A3, leja_points, div_diff, v=v1) -\
#         (A2*np.exp(2.0)).dot(v1)
# print('A3 v1: ', delta)
#
# delta = exp(A3, leja_points, div_diff, v=v2) -\
#         (A2*np.exp(2.0)).dot(v2)
# print('A3 v2: ', delta)
#
# delta = exp(A3, leja_points, div_diff, v=v3) -\
#         (A2*np.exp(2.0)).dot(v3)
# print('A3 v3: ', delta)
# print('--------------')

from exponentiation.exp import matrix_exp_puzzer as exp

A1 = np.matrix([[1., 2., 3.], [2., 1., -1.], [3., -1., 1.]])
v = np.array([[1.0], [0.0], [0.0]])
a = exp(A1, v, 1.0)
print('#' * 30)
print(a)