Question

In: Computer Science

for input matrix a , write a function to return the element in row 2 column...

for input matrix a , write a function to return the element in row 2 column 3 of that matrix

Solutions

Expert Solution

Since you have not mentioned language i'm doing this in python.

# A basic code for matrix input from user

R = int(input("Enter the number of rows:"))
C = int(input("Enter the number of columns:"))

# Initialize matrix
matrix = []
print("Enter the entries row wise:")

if(R!=0) and (C!=0):
# For user input
for i in range(R):       # A for loop for row entries
   a =[]
   for j in range(C):   # A for loop for column entries
       a.append(int(input()))
   matrix.append(a)

# For printing the matrix
for i in range(R):
   for j in range(C):
       print(matrix[i][j], end = " ")
   print()     
print("The element in 2nd row 3rd column is ",matrix[1][2])

OUTPUT

  
  
  


Related Solutions

Write a function called ReturnOddEntries.m that accepts as input a column or row array (vector) and...
Write a function called ReturnOddEntries.m that accepts as input a column or row array (vector) and returns only the odd index entries. Do this by first setting the even entries to 0, and then removing the 0 entries by using a logical array. The first line of your code should read function p = ReturnOddEntries(p) For example, if you run in the command window p = ReturnOddEntries([1.2 7.1 8.4 -42 100.1 7 -2 4 6]), then you should get p...
write a function that return a list of row numbers in matrix with removing the wrong...
write a function that return a list of row numbers in matrix with removing the wrong value. Ex: remove_row( matrix, wro) if matrix = [[5,2,8],[6,7,20],[10,25,9]] wro= 20 then output will be [1,2] Do not use any built in functions.
How are the column space and the row space of a matrix A related to the...
How are the column space and the row space of a matrix A related to the column space and row space of its reduced row echelon form? How does this prove the column rank of A equals the row rank?
Write a function script DirCos.m that takes a vector (any row or column array) as the...
Write a function script DirCos.m that takes a vector (any row or column array) as the argument and returns the direction cosines for that vector. This is for a MatLab script
Find x1 and x2. left bracket Start 2 By 2 Matrix 1st Row 1st Column negative...
Find x1 and x2. left bracket Start 2 By 2 Matrix 1st Row 1st Column negative 4 2nd Column 1 2nd Row 1st Column 5 2nd Column 4 End Matrix right bracket left bracket Start 2 By 1 Matrix 1st Row 1st Column x 1 2nd Row 1st Column x 2 End Matrix right bracket plus left bracket Start 2 By 1 Matrix 1st Row 1st Column 11 2nd Row 1st Column negative 19 EndMatrix right bracket equals left bracket...
A. Write a function in MATLAB called findTranspose that takes in as input any matrix or...
A. Write a function in MATLAB called findTranspose that takes in as input any matrix or any vector and simply returns back the transpose of that input. You can always verify your answer by using the inbuilt transpose function in MATLAB, however, you cannot use the transpose function directly when writing your code. Here is the starter code that we are providing to help you get started %x is the input vector or matrix. You can find the %size that...
a.) Find a basis for the row space of matrix B. b.) Find a basis for the column space of matrix B.
For the given matrix B= 1 1 1 3 2 -2 4 3 -1 6 5 1 a.) Find a basis for the row space of matrix B. b.) Find a basis for the column space of matrix B. c.)Find a basis for the null space of matrix B. d.) Find the rank and nullity of the matrix B.
How to print the element in the fifth row and seventh column given this array declaration...
How to print the element in the fifth row and seventh column given this array declaration in dev c: int hello[5][10];
Let A be an n × n real symmetric matrix with its row and column sums...
Let A be an n × n real symmetric matrix with its row and column sums both equal to 0. Let λ1, . . . , λn be the eigenvalues of A, with λn = 0, and with corresponding eigenvectors v1,...,vn (these exist because A is real symmetric). Note that vn = (1, . . . , 1). Let A[i] be the result of deleting the ith row and column. Prove that detA[i] = (λ1···λn-1)/n. Thus, the number of spanning...
Write a function that will accept one integer matrix E and one column vector F by...
Write a function that will accept one integer matrix E and one column vector F by reference parameters, and one integer I as a value parameter. The function will return an integer v, which is the i-th coefficient of row vector denoted by E*F (multiplication of E and F). For example, if V = E*F, the function will return v, which is equal to V[i]. Explain the time complexity of this function inside of the function code as a comment....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT