u = [-2,-1,0,1]
v = [1,2,3]

uv = []
vu = []


for i in range(len(u)): # one element of u is picked
    for j in range(len(v)): # now we iteratively select every element of v
        uv.append(u[i]*v[j]) # this one element of u is iteratively multiplied with every element of v 
    
print("u-tensor-v is",uv)    

for i in range(len(v)): # one element of v is picked
    for j in range(len(u)): # now we iteratively select every element of u
        vu.append(v[i]*u[j]) # this one element of v is iteratively multiplied with every element of u 
    
print("v-tensor-u is",vu)    

A = [
    [-1,0,1],
    [-2,-1,2]
]

B = [
    [0,2],
    [3,-1],
    [-1,1]
]

print("A =")
for i in range(len(A)):
    print(A[i])

print() # print a line
print("B =")
for i in range(len(B)):
    print(B[i])

# let's define A-tensor-B as a (6x6)-dimensional zero matrix
AB = []
for i in range(6):
    AB.append([])
    for j in range(6):
        AB[i].append(0)

    
        
# let's find A-tensor-B
for i in range(2):
    for j in range(3):
        # for each A(i,j) we execute the following codes
        a = A[i][j]
        # we access each element of B
        for m in range(3):
            for n in range(2):
                b = B[m][n]
                # now we put (a*b) in the appropriate index of AB
                AB[3*i+m][2*j+n] = a * b
    
    

print() # print a line
print("A-tensor-B =") 
print() # print a line
for i in range(6):
    print(AB[i])

A = [
    [-1,0,1],
    [-2,-1,2]
]

B = [
    [0,2],
    [3,-1],
    [-1,1]
]

print() # print a line
print("B =")
for i in range(len(B)):
    print(B[i])
    
print("A =")
for i in range(len(A)):
    print(A[i])

# let's define B-tensor-A as a (6x6)-dimensional zero matrix
BA = []
for i in range(6):
    BA.append([])
    for j in range(6):
        BA[i].append(0)
        
# let's find B-tensor-A
for i in range(3):
    for j in range(2):
        # for each B(i,j) we execute the following codes
        b = B[i][j]
        # we access each element of A
        for m in range(2):
            for n in range(3):
                a = A[m][n]
                # now we put (a*b) in the appropriate index of AB
                BA[2*i+m][3*j+n] = b * a
    
    

print() # print a line
print("B-tensor-A =") 
print() # print a line
for i in range(6):
    print(BA[i])

