What is the matrix?
A matrix is also a belong array of numbers (or various mathematical objects) that operations like addition and multiplication are printed most typically, a matrix over a field F is also an oblong array of scalars, each of that will be a member of F.[9][10] Most of this text focuses on real and complicated matrices, matrices whose elements are severally real numbers or advanced numbers.
- Step for the addition of two matrices
Create one matrix in form of 3*3 with x variable
Lets understand with example:
X = [[19,6,3],
[4 ,4,4],
[7 ,5,9]]
Create second matrix in form of 3*3 with y variable
Y = [[5,8,15],
[6,5,3],
[5,5,9]]
Create a another matrix and all input in form of zero with sum variable
sum = [[0,0,0],
[0,0,0],
[0,0,0]]
I run the for loop for rows and length of x matrix
for i in range(len(X)):
I run another for loop for matrix columns
for j in range(len(X[0])):
I apply matrix addition logic
sum[i][j] = X[i][j] + Y[i][j]
I run for loop for sum variable to print the matrix
for r in sum:
print(r)
The final output is :
[24, 14, 18]
[10, 9, 7]
[12, 10, 18]
- Step for multiplication of two matrices
Create one matrix in form of 3*3 with x variable
Lets understand with example:
X = [[19,6,3],
[4 ,4,4],
[7 ,5,9]]
Create second matrix in form of 3*4 with y variable
Y =[[5,8,1,2],
[6,7,3,0],
[4,5,9,1]]
Create a another matrix and all input in form of zero with mul variable
mul = [[0,0,0],
[0,0,0],
[0,0,0]]
I run the for loop for rows and length of x matrix
for i in range(len(X)):
I run another for loop for y matrix columns
for j in range(len(y[0])):
I run another for loop for y matrix rows
for k in range(len(Y)):
I apply matrix multiplication logic
mul[i][j] += X[i][k] * Y[k][j]
I run for loop for mul variable to print the matrix
for r in mul:
print(r)
The final output is :
[143, 209, 64, 41]
[60, 80, 52, 12]
[101, 136, 103, 23]
- Step for transpose of two matrices
Create one matrix in form of 2*3 with x variable
Lets understand with example:
X =[[12,7],
[4 ,5],
[3 ,8]]
Create a another matrix and all input in form of zero with trans variable
trans =[[0,0,0],
[0,0,0]]
for i in range(len(X)):
I run another for loop for matrix columns
for j in range(len(X[0])):
I apply matrix trans logic
trans[j][i] = X[i][j]
I run for loop for sum variable to print the matrix
for r in trans:
Print(r)
The final output is :
[12, 4, 3]
[7, 5, 8]
#matrix #balayage #hair #matrixcolor #behindthechair #haircolor #olaplex #haircut #hairstylist #johnwick #keanureeves #redken #hairstyles #hairdresser #matrixindonesia #thematrix #love #hairgoals #highlights #blondehair #blonde #modernsalon #salon #hairstyle #keanu #neo #loreal #wakeup #biolage #bhfyp
#somaymangla #somaymangla #somaymangla
#somaymangla
#somaymangla
Author
Very knowledgeable
ReplyDelete