Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Note: Dont use numpy, use the basic core and functions QN: Create two square matrices X & Y of equal dimensions Enter the elements for

Note: Dont use numpy, use the basic core and functions

QN: Create two square matrices X & Y of equal dimensions Enter the elements for matrix X and Y Add all the elements of first row and second column and place the value in R2C2 for X & Y Add all the elements of second row and third column and place the value in R3C3 for X & Y Add all the elements of third row and first column and place the value in R1C1 for X & Y Replace all the elements as 0 except diagonal values in both X & Y Reverse the diagonal elements and make a new matrix for both X & Y

Note: Code should have these input and output.

############# Input: ############# 3 #Enter the number of rows: 3 #Enter the number of columns: 1 #Enter the entries row-wise for matrix X 2 3 4 5 6 7 8 9 2 #Enter the entries rowwise for matrix Y 3 4 5 6 7 8 9 1

Output: [[1, 2, 3], [4, 5, 6], [7, 8, 9]] #Print Matrix X [[2, 3, 4], [5, 6, 7], [8, 9, 1]] #Print Matrix Y [[29, 0, 0], [0, 19, 0], [0, 0, 27]] # Resultant X [[27, 0, 0], [0, 19, 0], [0, 0, 29]] # Reverse of diagonal of Resultant X [[25, 0, 0], [0, 24, 0], [0, 0, 23]] # Resultant Y [[23, 0, 0], [0, 24, 0], [0, 0, 25]] # Reverse of diagonal of Resultant Y

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions