Exercise 551

Given two matrixes A and B: 

Give the numpy python code which calculates t(B)A (the inner product or dot product)

Solution

import numpy as np

A = np.array([[3,2] ,
[2,3]])
B = np.array([[1,0] ,
[4,-1]])
X = np.dot(B.T, A)

print("The product t(B)A is : " , X)
# The out put is : The product t(B)A is : [[11 14] [-2 -3]]

Younes Derfoufi
my-courses.net

Leave a Reply